Skip to content

fix(opencode): apply long context config pricing - #42919

Open
dpclark4 wants to merge 2 commits into
anomalyco:devfrom
dpclark4:fix-200k-pricing
Open

fix(opencode): apply long context config pricing#42919
dpclark4 wants to merge 2 commits into
anomalyco:devfrom
dpclark4:fix-200k-pricing

Conversation

@dpclark4

@dpclark4 dpclark4 commented Aug 16, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #42910

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This fixes a bug where locally computed costs do not account for context tiered pricing. For models with higher pricing above a context threshold (e.g. 200k), the local pricing logic continued using the lower tier after the session crossed that threshold.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Wrote two tests to verify locally with tiered Grok model:

  • 199K and 200K tokens use the base rate. 201K tokens uses the long context rate
  • existing long context pricing remains when config does not provide an override

If we want extra confidence, I can build an opencode version off of this change, and retest the grok scenario I flagged in the linked issue. Let me know.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@dpclark4 dpclark4 changed the title fix(opencode): apply long-context config pricing fix(opencode): apply long context config pricing Aug 16, 2026
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect session cost estimate for models with context tiered pricing

1 participant