You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Support explicit cost tiers for custom provider models #50713
Configured tiers are accepted and included in a custom model cost definition.
A configured tier replaces a catalog tier with the same type and size.
Unrelated catalog tiers are preserved.
Cost estimation uses the base rate at or below 272K tokens and the configured tier above it.
This complements #44223 and #44292, which address runtime handling of catalog tiers but intentionally do not add arbitrary tiers to custom configuration.
Feature requests should use the feature request template, which requires a title starting with [FEATURE]: and a verification checkbox confirming you've searched for existing issues
Please resubmit or edit this issue using the feature request template
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
changed the title [-]Support explicit cost tiers for custom provider models[/-][+][FEATURE]: Support explicit cost tiers for custom provider models[/+]on Sep 22, 2026
I just want to add we have numerous public examples now of where the price tier split is needed. Claude 5.5 haiku has a price tier cutoff of 100k tokens. Grok has a cutoff of 200k tokens for its price tier. In order to have accurate prices, there needs to be a way to set cost tiers.
Some data on how often a tier boundary is actually crossed in agent traffic, which bears on how much a missing tiers field skews the estimate:
Across 79,276 coding-agent requests (OpenCode, Cline, Roo, Kilo, Aider, Continue, Zed and others) on one OpenAI-compatible gateway, 2026-09-13 to 2026-10-12, input tokens per request (cache reads included) were:
median 99.6K, p90 280K, p99 533K
49.7% of requests over 100K, the Haiku 5.5 cutoff mentioned above
10.7% of requests over 272K, the GPT-6 Luna cutoff
So with only context_over_200k available, a model with a 272K or 100K boundary gets the wrong rate on roughly 1 in 10 (or 1 in 2) requests in a long session. Those are the most expensive requests, so the error in a session total is larger than the request share suggests. One more thing worth handling: 87% of those input tokens were cache reads, so the tier needs its own cache_read rate. The proposed shape in the issue already allows that.
Thanks for the detailed request! You'd like custom provider models in opencode.json to set arbitrary context-pricing tiers (for example a long-context rate above 272K tokens), merged per tier with catalog tiers. Maintainers will consider it.
In the meantime, if you're on OpenCode v2 (opencode --version shows 2.x), v2's own config format already accepts arbitrary tiers. There, cost can be a list, and each entry can have a tier:
Note that a configured cost currently replaces the model's whole cost list rather than merging with catalog tiers one by one, so include every tier you need. The legacy snake_case shape (cache_read, context_over_200k) is still limited to the 200K tier.
Related (all closed; they fixed how v1 picks catalog tiers when estimating cost):
Activity
github-actions commentedon Sep 22, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:and a verification checkbox confirming you've searched for existing issuesPlease edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
context_over_200k/ tiers gap)If you believe this was flagged incorrectly, please let a maintainer know.
[-]Support explicit cost tiers for custom provider models[/-][+][FEATURE]: Support explicit cost tiers for custom provider models[/+]github-actions commentedon Sep 22, 2026
Thanks for updating the issue! It now follows the contributing guidelines. We'll take a look.
EncodedBird commentedon Oct 11, 2026
I just want to add we have numerous public examples now of where the price tier split is needed. Claude 5.5 haiku has a price tier cutoff of 100k tokens. Grok has a cutoff of 200k tokens for its price tier. In order to have accurate prices, there needs to be a way to set cost tiers.
henrikdukefoss commentedon Oct 13, 2026
Some data on how often a tier boundary is actually crossed in agent traffic, which bears on how much a missing
tiersfield skews the estimate:Across 79,276 coding-agent requests (OpenCode, Cline, Roo, Kilo, Aider, Continue, Zed and others) on one OpenAI-compatible gateway, 2026-09-13 to 2026-10-12, input tokens per request (cache reads included) were:
So with only
context_over_200kavailable, a model with a 272K or 100K boundary gets the wrong rate on roughly 1 in 10 (or 1 in 2) requests in a long session. Those are the most expensive requests, so the error in a session total is larger than the request share suggests. One more thing worth handling: 87% of those input tokens were cache reads, so the tier needs its owncache_readrate. The proposed shape in the issue already allows that.Disclosure: the numbers come from the gateway I run (Standard Compute). The aggregate method and data file are public: https://standardcompute.com/agent-burn-index (JSON at
/agent-burn-index/data.json).opencodejr commentedon Oct 28, 2026
Thanks for the detailed request! You'd like custom provider models in
opencode.jsonto set arbitrary context-pricing tiers (for example a long-context rate above 272K tokens), merged per tier with catalog tiers. Maintainers will consider it.In the meantime, if you're on OpenCode v2 (
opencode --versionshows 2.x), v2's own config format already accepts arbitrary tiers. There,costcan be a list, and each entry can have atier:{ "provider": { "my-gateway": { "models": { "my-model": { "cost": [ { "input": 2, "output": 10, "cache": { "read": 0.2, "write": 2.5 } }, { "tier": { "type": "context", "size": 272000 }, "input": 4, "output": 15, "cache": { "read": 0.4, "write": 5 } } ] } } } } }Note that a configured
costcurrently replaces the model's whole cost list rather than merging with catalog tiers one by one, so include every tier you need. The legacy snake_case shape (cache_read,context_over_200k) is still limited to the 200K tier.Related (all closed; they fixed how v1 picks catalog tiers when estimating cost):