mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
chore(registry): per-model contextLength/maxOutputTokens for active providers
The /v1/models catalog endpoint reads `model.contextLength` directly from
the REGISTRY entries (src/app/api/v1/models/catalog.ts:823) and falls back
to REGISTRY[provider].defaultContextLength → getTokenLimit chain otherwise.
`max_output_tokens` flows through enrichCatalogModelEntry which calls
getResolvedModelCapabilities (src/lib/modelCapabilities.ts:261-265) reading
the same per-model registry fields.
Currently most non-default-spec models lack explicit contextLength /
maxOutputTokens, so /v1/models advertises stale defaults
(DEFAULT_LIMITS.default = 128000, MODEL_SPECS.__default__.maxOutputTokens
= 8192). Clients that read these values to compute compression thresholds
or prompt budgets (e.g. Capy reading context_length for its compress
trigger) over-aggressively trim long conversations.
Provider IDs in the registry (`claude`, `kimi-coding`, `xiaomi-mimo`) do
not match the canonical IDs synced from models.dev (`anthropic`, `cc`,
`xiaomi`), so the DB lookup misses for these entries. The cleanest fix
is to populate the registry directly with values consensus'd across 6+
upstream sync sources (anthropic, cc, openrouter, kilocode, vercel,
xiaomi-token-plan-*, llmgateway, kc, kilo-gateway).
Values:
- claude (id="claude", alias="cc"):
opus-4-7, opus-4-6 → 1M ctx / 128K max_out
opus-4-5-20251101, sonnet-4-6, sonnet-4-5-20250929, haiku-4-5-20251001
→ 200K ctx / 64K max_out
- kiro (alias="kr"): same opus/sonnet/haiku tiering
- github (alias="gh"): same claude subset tiering
- KIMI_CODING_SHARED:
kimi-k2.6, kimi-k2.6-thinking → 262K ctx / 262K max_out
- xiaomi-mimo:
mimo-v2.5-pro, mimo-v2.5 → 1M ctx / 131K max_out
mimo-v2-omni → 262K ctx / 131K max_out
mimo-v2-flash → 262K ctx / 65K max_out
The 1M context tier for claude-opus-4-6/4-7 requires the
`context-1m-2025-08-07` beta header which selectBetaFlags() already
attaches automatically for full-agent traffic (hasTools && hasSystem,
the Capy pattern) — see open-sse/executors/claudeIdentity.ts:304. No
wire-level change needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -143,8 +143,8 @@ const KIMI_CODING_SHARED = {
|
||||
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
|
||||
},
|
||||
models: [
|
||||
{ id: "kimi-k2.6", name: "Kimi K2.6" },
|
||||
{ id: "kimi-k2.6-thinking", name: "Kimi K2.6 Thinking" },
|
||||
{ id: "kimi-k2.6", name: "Kimi K2.6", contextLength: 262144, maxOutputTokens: 262144 },
|
||||
{ id: "kimi-k2.6-thinking", name: "Kimi K2.6 Thinking", contextLength: 262144, maxOutputTokens: 262144 },
|
||||
] as RegistryModel[],
|
||||
} as const;
|
||||
|
||||
@@ -281,7 +281,12 @@ const CHAT_OPENAI_COMPAT_MODELS: Record<string, RegistryModel[]> = {
|
||||
codestral: buildModels(["codestral-2405", "codestral-latest"]),
|
||||
upstage: buildModels(["solar-pro3", "solar-mini"]),
|
||||
maritalk: buildModels(["sabia-4", "sabia-3.1", "sabiazinho-4", "sabiazinho-3"]),
|
||||
"xiaomi-mimo": buildModels(["mimo-v2.5-pro", "mimo-v2.5", "mimo-v2-omni", "mimo-v2-flash"]),
|
||||
"xiaomi-mimo": [
|
||||
{ id: "mimo-v2.5-pro", name: "MiMo-V2.5-Pro", contextLength: 1048576, maxOutputTokens: 131072 },
|
||||
{ id: "mimo-v2.5", name: "MiMo-V2.5", contextLength: 1048576, maxOutputTokens: 131072 },
|
||||
{ id: "mimo-v2-omni", name: "MiMo-V2-Omni", contextLength: 262144, maxOutputTokens: 131072 },
|
||||
{ id: "mimo-v2-flash", name: "MiMo-V2-Flash", contextLength: 262144, maxOutputTokens: 65536 },
|
||||
],
|
||||
"inference-net": buildModels([
|
||||
"meta-llama/Llama-3.3-70B-Instruct",
|
||||
"deepseek-ai/DeepSeek-R1",
|
||||
@@ -379,11 +384,12 @@ export const REGISTRY: Record<string, RegistryEntry> = {
|
||||
tokenUrl: "https://console.anthropic.com/v1/oauth/token",
|
||||
},
|
||||
models: [
|
||||
{ id: "claude-opus-4-7", name: "Claude Opus 4.7", supportsXHighEffort: true },
|
||||
{ id: "claude-opus-4-6", name: "Claude Opus 4.6", supportsXHighEffort: false },
|
||||
{ id: "claude-sonnet-4-6", name: "Claude 4.6 Sonnet", supportsXHighEffort: false },
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude 4.5 Sonnet", supportsXHighEffort: false },
|
||||
{ id: "claude-haiku-4-5-20251001", name: "Claude 4.5 Haiku", supportsXHighEffort: false },
|
||||
{ id: "claude-opus-4-7", name: "Claude Opus 4.7", supportsXHighEffort: true, contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "claude-opus-4-6", name: "Claude Opus 4.6", supportsXHighEffort: false, contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5", supportsXHighEffort: false, contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-sonnet-4-6", name: "Claude 4.6 Sonnet", supportsXHighEffort: false, contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-sonnet-4-5-20250929", name: "Claude 4.5 Sonnet", supportsXHighEffort: false, contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-haiku-4-5-20251001", name: "Claude 4.5 Haiku", supportsXHighEffort: false, contextLength: 200000, maxOutputTokens: 64000 },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -567,16 +573,12 @@ export const REGISTRY: Record<string, RegistryEntry> = {
|
||||
{ id: "gpt-5.4-mini", name: "GPT-5.4 Mini", targetFormat: "openai-responses" },
|
||||
{ id: "gpt-5.4", name: "GPT-5.4", targetFormat: "openai-responses" },
|
||||
{ id: "gpt-5.5", name: "GPT-5.5", ...GPT_5_5_CODEX_CAPABILITIES },
|
||||
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5", targetFormat: "openai-responses" },
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", targetFormat: "openai-responses" },
|
||||
{ id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6", targetFormat: "openai-responses" },
|
||||
{
|
||||
id: "claude-opus-4-5-20251101",
|
||||
name: "Claude Opus 4.5 (Full ID)",
|
||||
targetFormat: "openai-responses",
|
||||
},
|
||||
{ id: "claude-opus-4.6", name: "Claude Opus 4.6", targetFormat: "openai-responses" },
|
||||
{ id: "claude-opus-4.7", name: "Claude Opus 4.7", targetFormat: "openai-responses" },
|
||||
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5", targetFormat: "openai-responses", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", targetFormat: "openai-responses", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6", targetFormat: "openai-responses", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5 (Full ID)", targetFormat: "openai-responses", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-opus-4.6", name: "Claude Opus 4.6", targetFormat: "openai-responses", contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "claude-opus-4.7", name: "Claude Opus 4.7", targetFormat: "openai-responses", contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro", targetFormat: "openai-responses" },
|
||||
{ id: "gemini-3-flash-preview", name: "Gemini 3 Flash", targetFormat: "openai-responses" },
|
||||
{ id: "oswe-vscode-prime", name: "Raptor Mini", targetFormat: "openai-responses" },
|
||||
@@ -600,12 +602,12 @@ export const REGISTRY: Record<string, RegistryEntry> = {
|
||||
},
|
||||
models: [
|
||||
{ id: "auto-kiro", name: "Auto (Kiro picks best model)" },
|
||||
{ id: "claude-opus-4.7", name: "Claude Opus 4.7" },
|
||||
{ id: "claude-opus-4.6", name: "Claude Opus 4.6" },
|
||||
{ id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6" },
|
||||
{ id: "claude-opus-4.7", name: "Claude Opus 4.7", contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "claude-opus-4.6", name: "Claude Opus 4.6", contextLength: 1000000, maxOutputTokens: 128000 },
|
||||
{ id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
// models for kiro free tier
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5" },
|
||||
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5" },
|
||||
{ id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5", contextLength: 200000, maxOutputTokens: 64000 },
|
||||
{ id: "deepseek-3.2", name: "DeepSeek V3.2" },
|
||||
{ id: "minimax-m2.5", name: "MiniMax M2.5" },
|
||||
{ id: "minimax-m2.1", name: "MiniMax M2.1" },
|
||||
|
||||
Reference in New Issue
Block a user