Repository navigation
refactor(opencode): one price mapper for catalog and config cost tiers - #35
Merged
Merged
Conversation
Andrew's simplification of #34: a single price() turns models.dev and config cost shapes into {input, output, cache}, the merge no longer sets experimentalOver200K alongside a config-derived 200K tier, and the two override tests collapse into one covering gpt-5.4 and grok-4. No pricing change beyond the legacy field now being undefined whenever tiers exist. Co-Authored-By: Andrew Wang <andrew@replo.app> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
|
/devin review |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
PierrotAWB
approved these changes
Sep 2, 2026
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.
Follow-up to #34, applying the simplification patch Andrew posted in Slack verbatim. No merge until Andrew and Gabe have reviewed.
Context
#34 landed the tiered-pricing fix with four hand-written mappings from models.dev / config cost shapes (
cache_read,cache_write) to the model's{ input, output, cache }, and the config merge still setexperimentalOver200Kalongside the 200K tier it synthesizes from a configcontext_over_200k, contradicting the converter's rule that the legacy field exists only when a model has no tiers.Changes
price()mapper handles base cost, catalog tiers, the catalog'scontext_over_200k, and a configcontext_over_200k.experimentalOver200Ktoundefinedwhenever it synthesizes the 200K tier, so catalog-only and config-named models follow the same rule.openai/gpt-5.4(catalog tier at 272K replaced by the 200K tier) andx-ai/grok-4(catalog tier at 128K kept below it), priced throughSession.getUsageat 150K and 300K.Testing Done
cd packages/opencode && bun test test/provider/provider.test.ts: 97 pass (one fewer test than fix(opencode): price long-context steps at the catalog tier, including config-named models #34 by design).bun run typecheckinpackages/opencode: clean.experimentalOver200K: undefinednext to its tiers, whichSession.getUsagenever read in that case.Patch by Andrew Wang, from the Slack thread on #34.
🤖 Generated with Claude Code
Summary by cubic
Uses one
price()mapper to normalize catalog and config cost tiers. Previously, a configcontext_over_200koverride populated both a synthesized 200K tier andexperimentalOver200K; now it creates only the tier and clears the legacy field, while usage pricing remains unchanged.Refactors
price()for base costs, catalog tiers, and long-context overrides.openai/gpt-5.4catalog tier and retaining the lowerx-ai/grok-4tier.Written for commit 54c1933. Summary will update on new commits.