Skip to content

Commit 06b856c

Browse files
committed
LLMs: 0-day fallbacks: mark type-blind vendors, never invent context
1 parent 539f3ed commit 06b856c

14 files changed

Lines changed: 61 additions & 38 deletions

src/modules/llms/server/gemini/gemini.models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,10 @@ export function geminiModelToModelDescription(geminiModel: GeminiWire_API_Models
11581158
? `🔗 ${knownModel?.labelOverride || displayName} -> ${knownModel.symLink}`
11591159
: knownModel?.labelOverride || displayName;
11601160

1161+
// no '[?]' marker (evaluated 2026-08-14): API-characterized (supportedGenerationMethods + real ctx) - see llmsLabelUncurated
1162+
// if (!knownModel)
1163+
// label = llmsLabelUncurated(label);
1164+
11611165
// FIX: the Gemini 1114 model now returns 1121 as the version.. highlight the issue
11621166
// if (geminiModel.name.endsWith('1114') && label.endsWith('1121'))
11631167
// label += ' (really: 1114)';

src/modules/llms/server/models.mappings.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ import type { ModelDescriptionSchema } from './llm.server.types';
99
// -- Uncurated-model label marker --
1010

1111
/**
12-
* '[?] ' label prefix: marks a model no editorial table covers yet (0-day arrivals, unknown
13-
* variants). Writers: fromManualMapping 'super' resolution (below), nvidianim/modular 0-day
14-
* fallbacks. Readers: llm-registry-sync holds prefix-marked models with null contextWindow off
15-
* the publication push; listModels.test curated-context assertion; the website strips the
16-
* brackets and sinks the pub date (own regex, website repo - keep in sync on change).
17-
* Legacy variants not yet unified: bedrock ' [?]' label suffix, openai fallback bare '?'.
12+
* '[?] ' label prefix - "the list API does not establish what this model IS".
13+
* Not an "uncatalogued" badge: API-characterized 0-day arrivals stay unmarked.
14+
*
15+
* Mark: type-blind catalogs (ids only), where a video/TTS/embedding id could masquerade as
16+
* chat - nvidianim, modular, sakanaai, moonshot, groq, deepseek, alibaba - plus the
17+
* 'super' resolution below (unknown variant of a known family).
18+
* Don't: a type/modality filter proves chat - gemini, xai, together, novita, chutesai, cerebras.
19+
*
20+
* Readers: llm-registry-sync (marked + null contextWindow = held off the publication push),
21+
* listModels.test, the website (strips brackets, sinks pubDate; own regex, keep in sync).
22+
*
23+
* Legacy, not unified: bedrock ' [?]' suffix, openai bare '?'.
1824
*/
1925
const LLM_LABEL_UNCURATED = '[?]';
2026

src/modules/llms/server/openai/models/alibaba.models.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LLM_IF_OAI_Chat, LLM_IF_OAI_Fn, LLM_IF_OAI_Reasoning, LLM_IF_OAI_Vision
22

33
import type { ModelDescriptionSchema } from '../../llm.server.types';
44

5-
import { fromManualMapping, llmsDefineManualMappings } from '../../models.mappings';
5+
import { fromManualMapping, llmsDefineManualMappings, llmsLabelUncurated } from '../../models.mappings';
66

77
// --- Alibaba Model ID inference (auto-derived from _knownAlibabaChatModels) ---
88
export type LlmsAlibabaModelId = typeof _knownAlibabaChatModels[number]['idPrefix'];
@@ -339,10 +339,9 @@ export function alibabaModelFilter(modelId: string): boolean {
339339
export function alibabaModelToModelDescription(alibabaModelId: string, created?: number): ModelDescriptionSchema {
340340
const md = fromManualMapping(_knownAlibabaChatModels, alibabaModelId, created, undefined, {
341341
idPrefix: alibabaModelId,
342-
label: _alibabaFormatNewLabel(alibabaModelId),
342+
label: llmsLabelUncurated(_alibabaFormatNewLabel(alibabaModelId)),
343343
description: 'Alibaba model (not yet curated).',
344-
contextWindow: 131072,
345-
maxCompletionTokens: 8192,
344+
contextWindow: null, // the list API returns ids only - no context to trust
346345
interfaces: [LLM_IF_OAI_Chat, LLM_IF_OAI_Fn],
347346
hidden: true, // editorial policy: hide uncatalogued models by default (title-cased label only if ever shown)
348347
});

src/modules/llms/server/openai/models/cerebras.models.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,17 @@ function _cerebrasApiModelToFallback(model: WireCerebrasModel): KnownModel {
119119
const chatPrice = isFree ? { input: 'free' as const, output: 'free' as const } : { input: inputPerM, output: outputPerM };
120120

121121
const isPreview = !!model.preview;
122+
// catalog context or null, never a guess
123+
// no '[?]' marker (evaluated 2026-08-14): API-characterized (modality filter + catalog capabilities) - see llmsLabelUncurated
124+
const contextWindow = limits.max_context_length || null;
122125
const label = (model.name || model.id.replaceAll(/[_-]/g, ' ')) + (isPreview ? ' (Preview)' : '');
123126

124127
return {
125128
idPrefix: model.id,
126129
isPreview,
127130
label,
128131
description: model.description || 'New Cerebras model.',
129-
contextWindow: limits.max_context_length || 131072,
132+
contextWindow,
130133
...(limits.max_completion_tokens ? { maxCompletionTokens: limits.max_completion_tokens } : {}),
131134
interfaces,
132135
...(parameterSpecs.length ? { parameterSpecs } : {}),

src/modules/llms/server/openai/models/chutesai.models.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,20 @@ export function chutesAIModelsToModelDescriptions(wireModels: unknown): ModelDes
115115
if (_chutesDenyListContains.some(contains => model.id.includes(contains)))
116116
continue;
117117

118+
// skip non-text-output models (image/video generation): they would masquerade as chat here
119+
if (model.output_modalities?.length && !model.output_modalities.includes('text'))
120+
continue;
121+
118122
try {
119123
// label / description
120124
const label = _prettyModelId(model.id);
121125
const ownerStr = model.owned_by ? serverCapitalizeFirstLetter(model.owned_by) : '';
122126
const quantStr = model.quantization ? ` (${model.quantization})` : '';
123127
const description = `${ownerStr || 'Model'}${quantStr} via ChutesAI.`;
124128

125-
// context window: prefer explicit `context_length`, fall back to legacy `max_model_len`, then 8K
126-
const contextWindow = model.context_length || model.max_model_len || 8192;
129+
// context window: prefer explicit `context_length`, legacy `max_model_len`, else null (never a guess)
130+
// no '[?]' marker (evaluated 2026-08-14): API-characterized (output_modalities drop above) - see llmsLabelUncurated
131+
const contextWindow = model.context_length || model.max_model_len || null;
127132
const maxCompletionTokens = model.max_output_length || undefined;
128133

129134
// interfaces: derive from actual fields rather than assume

src/modules/llms/server/openai/models/deepseek.models.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LLM_IF_HOTFIX_StripImages, LLM_IF_OAI_Chat, LLM_IF_OAI_Fn, LLM_IF_OAI_R
22

33
import type { ModelDescriptionSchema } from '../../llm.server.types';
44

5-
import { llmsDefineManualMappings, fromManualMapping } from '../../models.mappings';
5+
import { llmsDefineManualMappings, fromManualMapping, llmsLabelUncurated } from '../../models.mappings';
66

77
// --- Deepseek Model ID inference (auto-derived from _knownDeepseekChatModels) ---
88
export type LlmsDeepseekModelId = typeof _knownDeepseekChatModels[number]['idPrefix'];
@@ -123,10 +123,9 @@ export function deepseekModelFilter(deepseekModelId: string) {
123123
export function deepseekModelToModelDescription(deepseekModelId: string): ModelDescriptionSchema {
124124
return fromManualMapping(_knownDeepseekChatModels, deepseekModelId, undefined, undefined, {
125125
idPrefix: deepseekModelId,
126-
label: deepseekModelId.replaceAll(/[_-]/g, ' '),
127-
description: 'New Deepseek Model',
128-
contextWindow: 128000,
129-
maxCompletionTokens: 4096,
126+
label: llmsLabelUncurated(deepseekModelId.replaceAll(/[_-]/g, ' ')),
127+
description: 'New DeepSeek arrival, not yet curated - capabilities and context window unverified.',
128+
contextWindow: null,
130129
interfaces: [LLM_IF_OAI_Chat],
131130
hidden: true,
132131
});

src/modules/llms/server/openai/models/groq.models.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LLM_IF_OAI_Chat, LLM_IF_OAI_Fn, LLM_IF_OAI_Reasoning, LLM_IF_OAI_Vision
22
import { Release } from '~/common/app.release';
33

44
import type { ModelDescriptionSchema } from '../../llm.server.types';
5-
import { type KnownLink, type KnownModel, formatPubDate, fromManualMapping, llmDevCheckModels_DEV, llmsDefineModels } from '../../models.mappings';
5+
import { type KnownLink, type KnownModel, formatPubDate, fromManualMapping, llmDevCheckModels_DEV, llmsDefineModels, llmsLabelUncurated } from '../../models.mappings';
66

77
// --- Groq Model ID inference (auto-derived from _knownGroqModels) ---
88
export type LlmsGroqModelId = typeof _knownGroqModels[number]['idPrefix'];
@@ -182,9 +182,9 @@ export function groqModelToModelDescription(_model: unknown): ModelDescriptionSc
182182

183183
const description = fromManualMapping(_knownGroqModels, model.id, model.created, undefined, {
184184
idPrefix: model.id,
185-
label: model.id.replaceAll(/[_-]/g, ' '),
186-
description: 'New Model',
187-
contextWindow: model.context_window || 32768,
185+
label: llmsLabelUncurated(model.id.replaceAll(/[_-]/g, ' ')),
186+
description: 'New Groq arrival, not yet curated - capabilities unverified.',
187+
contextWindow: model.context_window || null, // API value when present; null (not a guess) otherwise
188188
interfaces: [LLM_IF_OAI_Chat],
189189
hidden: true,
190190
});

src/modules/llms/server/openai/models/mistral.models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export function mistralModels(wireModels: unknown): ModelDescriptionSchema[] {
221221
created: created || 0,
222222
updated: /*updated ||*/ created || 0,
223223
description: description,
224-
contextWindow: max_context_length ?? 32768,
224+
contextWindow: max_context_length ?? null, // schema requires the field today; null (not a guess) if it ever loosens
225225
interfaces: _mistralCapabilitiesToInterfaces(capabilities, id),
226226
// parameterSpecs: ...
227227
// maxCompletionTokens: ...

src/modules/llms/server/openai/models/moonshot.models.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as z from 'zod/v4';
33
import { LLM_IF_HOTFIX_NoTemperature, LLM_IF_HOTFIX_StripImages, LLM_IF_OAI_Chat, LLM_IF_OAI_Fn, LLM_IF_OAI_Json, LLM_IF_OAI_PromptCaching, LLM_IF_OAI_Reasoning, LLM_IF_OAI_Vision } from '~/common/stores/llms/llms.types';
44

55
import type { ModelDescriptionSchema } from '../../llm.server.types';
6-
import { llmsDefineModels, fromManualMapping, KnownModel } from '../../models.mappings';
6+
import { llmsDefineModels, fromManualMapping, KnownModel, llmsLabelUncurated } from '../../models.mappings';
77

88
// --- Moonshot Model ID inference (auto-derived from _knownMoonshotModels) ---
99
export type LlmsMoonshotModelId = typeof _knownMoonshotModels[number]['idPrefix'];
@@ -335,9 +335,10 @@ export function moonshotModelToModelDescription(_model: unknown): ModelDescripti
335335
const description = fromManualMapping(_knownMoonshotModels, model.id, model.created, undefined, {
336336
// NOTE: default: let us know if any of these show up
337337
idPrefix: model.id,
338-
label: model.id.replaceAll(/[_-]/g, ' '),
339-
description: 'Unknown Moonshot Model',
340-
contextWindow: model.context_length || 128000,
338+
label: llmsLabelUncurated(model.id.replaceAll(/[_-]/g, ' ')),
339+
description: 'New Moonshot arrival, not yet curated - capabilities unverified.',
340+
contextWindow: model.context_length || null, // API value when present; null (not a guess) otherwise
341+
// optimistic capability leeway for 0-day arrivals; rein in when cataloged
341342
interfaces: [LLM_IF_OAI_Chat, LLM_IF_OAI_Fn, LLM_IF_OAI_Json, LLM_IF_OAI_PromptCaching],
342343
hidden: model.id.startsWith('moonshot-'), // hide older
343344
});

src/modules/llms/server/openai/models/novita.models.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ export function novitaModelsToModelDescriptions(wireModels: unknown): ModelDescr
7575
if (description.length > 200)
7676
description = description.slice(0, 200) + '...';
7777

78-
// Context window
79-
const contextWindow = model.context_size || 8192;
78+
// Context window: API value or null, never a guess
79+
// no '[?]' marker (evaluated 2026-08-14): API-characterized (model_type/endpoints filters) - see llmsLabelUncurated
80+
const contextWindow = model.context_size || null;
8081

8182
// Max completion tokens
8283
const maxCompletionTokens = model.max_output_tokens || undefined;

0 commit comments

Comments
 (0)