Skip to content

docs(sdk): deprecate context_over_200k - #5335

Merged
rekram1-node merged 1 commit into
devfrom
aiden/deprecate-context-over-200k
Aug 23, 2026
Merged

rekram1-node merged 1 commit into
devfrom
aiden/deprecate-context-over-200k

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

  • mark ModelCost.context_over_200k as deprecated in SDK type metadata
  • direct consumers to tiers for the exact context threshold
  • keep the compatibility field available for existing consumers

Checks

  • bun run --cwd packages/sdk generate
  • bun run --cwd packages/sdk typecheck
  • git diff --check

Requested by: @rekram1-node (Aiden via Slack)

@github-actions

Copy link
Copy Markdown
Contributor

No actionable findings.

@github-actions github-actions Bot added the reviewer: ready Automated review found no actionable items label Aug 23, 2026
@rekram1-node
rekram1-node merged commit f804dab into dev Aug 23, 2026
2 checks passed
@rekram1-node
rekram1-node deleted the aiden/deprecate-context-over-200k branch August 23, 2026 16:48
vitfera pushed a commit to vitfera/twenty that referenced this pull request Nov 13, 2026
…#30141)

Fixes twentyhq#30144

## Problem

The catalog sync prices long context from models.dev's
`context_over_200k` and gives every model a 200K threshold
(`LONG_CONTEXT_THRESHOLD_TOKENS`). models.dev deprecated that field on
2026-08-23
([anomalyco/models.dev#5335](anomalyco/models.dev#5335)).
The real threshold now comes from `cost.tiers[].tier.size`, and it isn't
always 200K:

- **13 OpenAI models** (gpt-6-luna, gpt-6-sol, gpt-6.1-sol, gpt-5.6,
gpt-5.5, gpt-5.4 and others) switch to long-context rates above
**272K**. `computeCostBreakdown` switches them at 200K, so a request of
200K–272K is debited at double the input rate.
- **Claude Haiku 5.5** switches above **100K**, to 5× its base rates.
models.dev publishes that tier only in `tiers`, so the catalog has no
`longContextCost` for it, and requests over 100K are debited at base
rates.

Debited by `computeCostBreakdown` today, against the provider's price
(90% of input cache-read, 1K output):

| Model | Input | Provider price | Debited today |
|---|---|---|---|
| gpt-6-luna | 240K | $0.0051 | $0.0099 |
| gpt-6.1-sol | 240K | $0.0796 | $0.1542 |
| claude-haiku-5-5 | 150K | $0.0168 | $0.0034 |

## Fix

- `extractCost` takes the lowest `context` tier from `cost.tiers` and
uses its `size` as `thresholdTokens`.
- It falls back to `context_over_200k` at 200K when a model has no
tiers.
- `ModelsDevModel` gains the `tiers` field.

Built against today's models.dev payload, the only catalog changes are:
- the 13 OpenAI thresholds (200K → 272K);
- Haiku 5.5 gaining its 100K tier;
- gpt-6.1-terra getting its 272K tier.

Rates and the Google and xAI entries are unchanged. `ai-models.json` and
`ai-providers.json` aren't regenerated here; the next daily sync
rewrites them. The regenerated catalog can be added to this PR if
preferred.

## Test plan

- [x] `build-catalog.spec.ts`: two new cases, a 272K tier quoted in both
fields and a 100K tier quoted only in `tiers`. Both fail on `main`
(200000 instead of 272000; `longContextCost` undefined) and pass with
the fix.
- [x] All suites under `scripts/ai-catalog-sync` and
`metadata-modules/ai` pass, except
`build-front-component-shared-dependencies`, which needs a local
`twenty-ui` build.
- [x] oxlint and oxfmt are clean on the changed files. `tsgo` reports no
errors in them.

Written with Claude Code (Claude Opus 5.5).


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/30141?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Etienne <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewer: ready Automated review found no actionable items

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant