fix(model-metadata): prioritize curated defaults over OpenRouter for known providers#23950
Closed
nicoechaniz wants to merge 1 commit into
Closed
fix(model-metadata): prioritize curated defaults over OpenRouter for known providers#23950nicoechaniz wants to merge 1 commit into
nicoechaniz wants to merge 1 commit into
Conversation
…known providers PROVIDER_TO_MODELS_DEV was missing 'kimi' and 'moonshot' provider mappings, causing the models.dev lookup to return None for users who configure provider: kimi directly. The context-length resolution chain then fell through to OpenRouter's community-maintained metadata (step 6), which reports 32,768 tokens for kimi-k2.6 — incorrect; the real context window is 262,144 tokens. Fix: 1. Add 'kimi' and 'moonshot' to PROVIDER_TO_MODELS_DEV pointing to kimi-for-coding, matching the existing kimi-coding/kimi-coding-cn entries. 2. Gate OpenRouter fallback behind 'not effective_provider' so that known providers skip third-party metadata and go straight to the project's curated DEFAULT_CONTEXT_LENGTHS table. OpenRouter data is community-maintained and should not override the project's own defaults for models belonging to known providers. 3. Add explicit DEFAULT_CONTEXT_LENGTHS entries for kimi-k2.6, kimi-k2.5, kimi-k2, k2p6, and k2p5 (all 262,144) as a safety net. Users who set provider: kimi in config.yaml now resolve to 262,144 tokens without needing an explicit model.context_length override. OpenRouter users and unknown-provider paths are unchanged.
kshitijk4poor
pushed a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
May 11, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR NousResearch#23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
Collaborator
|
Merged via PR #23980 with your authorship preserved. Thank you @nicoechaniz! Kept from your PR:
Note: the |
kshitijk4poor
pushed a commit
that referenced
this pull request
May 11, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR #23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
4 tasks
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR NousResearch#23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
jsboige
pushed a commit
to jsboige/hermes-agent
that referenced
this pull request
May 14, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR NousResearch#23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
AlexFoxD
pushed a commit
to AlexFoxD/hermes-agent
that referenced
this pull request
May 21, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR NousResearch#23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…onshot to PROVIDER_TO_MODELS_DEV Based on PR NousResearch#23950 by @nicoechaniz. - Add "kimi" and "moonshot" to PROVIDER_TO_MODELS_DEV → kimi-for-coding - Gate OpenRouter metadata step behind "if not effective_provider": known providers should not be overridden by community-maintained OR data - Keep the targeted Kimi-family 32k guard as a secondary safety net inside the OR gate (for unknown providers with Kimi models) Co-authored-by: nicoechaniz <nicoechaniz@altermundi.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users configuring
provider: kimidirectly (not through OpenRouter) get a context-window rejection:The real context window is 262,144 tokens. 32,768 comes from OpenRouter's community-maintained metadata, which the resolution chain consults before the project's own curated
DEFAULT_CONTEXT_LENGTHStable.Root Cause
Two issues in the context-length resolution chain (
agent/model_metadata.py):PROVIDER_TO_MODELS_DEVwas missing"kimi"and"moonshot"entries — onlykimi-codingandkimi-coding-cnwere mapped. Users settingprovider: kimigotNonefrom the models.dev lookup.After models.dev returned
None, the chain fell through to OpenRouter (step 6) before reachingDEFAULT_CONTEXT_LENGTHS(step 8). OpenRouter reports 32,768 forkimi-k2.6, which is incorrect but was accepted as authoritative because the curated defaults were never consulted.Fix
Add
"kimi"and"moonshot"toPROVIDER_TO_MODELS_DEV→"kimi-for-coding". This is consistent with the existingkimi-codingandkimi-coding-cnentries. Functionally, models.dev still uses different model IDs (k2p6/k2p5), so the lookup usually misses — but the mapping now exists for consistency.Gate OpenRouter behind
not effective_provider. If the provider is known (inferred from URL or set in config), skip OpenRouter's community-maintained metadata and fall through to the project's own curatedDEFAULT_CONTEXT_LENGTHStable. OpenRouter data can be incorrect and should not override the project's defaults for models belonging to known providers.Add explicit
DEFAULT_CONTEXT_LENGTHSentries forkimi-k2.6,kimi-k2.5,kimi-k2,k2p6,k2p5(all 262,144) as a safety net.Behavior changes
provider: kimi, model kimi-k2.6provider: kimi, model kimi-k2.5provider: openrouter, model kimi-k2.6¹ Fixed via models.dev now resolving the kimi provider mapping.
² Unchanged — OpenRouter data is the only available source for unknown providers.
Testing
tests/agent/test_model_metadata.pypasstests/agent/test_models_dev.pyandtests/agent/test_kimi_coding_anthropic_thinking.pypass