fix(models): managed first-party tier routing + pricing#27
Merged
Conversation
- Token estimation routes through the main-loop model on first-party so the reported usage comes back on the serving model's tokenizer (GLM, Kimi, and DeepSeek V4 Flash each have provider-specific tokenizers). - opusplan alias resolves to Opus (GLM 5.2) instead of Flash (Kimi). Plan mode wants Opus-tier reasoning; the previous Flash fallback was an Anthropic-era cost optimization. - getContextWindowForModel consults the managed model profile before the [1m] regex so a [1m] tag attached to a model that does not support 1M (Kimi today) cannot silently inflate the reported context window. Kimi + [1m] now correctly reports 200K; GLM and DeepSeek V4 Flash stay at their native 1M. - Adds context.1m-tier-contract.test.ts pinning the tier-tag contract for all three managed profiles.
GLM 5.2 - input $1.40 / output $4.40 / cached input $0.26 per Mtok Kimi K2.7 - input $0.95 / output $4.00 / cached input $0.19 per Mtok DeepSeek V4 Flash - input $0.14 / output $0.28 / cached input $0.0028 per Mtok Rates are set to match current competitor pricing for the equivalent upstream models. Cache-write rates default to the input rate where no separate cache-write tier is published. Adds modelCost.managed.test.ts to pin the managed-tier rates so future drift is caught.
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.
Two commits land the managed first-party tier contract and matching pricing.
fix(models): correct managed first-party tier routingfeat(models): set managed model pricingValidation: 30/30 tests pass across the worked files; build passes.