Skip to content

fix(core): read ChatGPT plan speeds from the account's own model list - #66705

Open
rekram1-node wants to merge 1 commit into
devfrom
openai-plan-sync
Open

rekram1-node wants to merge 1 commit into
devfrom
openai-plan-sync

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes #64968

Supersedes #64528, which turned the account list back on for Sign in with ChatGPT only and let it hide models. This covers both sign-ins and also decides speeds.

Type of change

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

What does this PR do?

The ChatGPT sign-ins (Codex and Sign in with ChatGPT) now read the signed-in account's own model list from OpenAI and use it to decide which speeds each model offers. The models.dev plan lists are the fallback.

Speeds depend on the plan, not just the model. Ultrafast is on Pro and eligible Enterprise and Edu plans only (OpenAI help), and models.dev can only list it for everyone or no one. OpenAI lists each model's speeds per account (service_tiers), so opencode now follows that:

 Plus account, GPT-6.2 Sol on the Codex sign-in
-  Standard, Fast, Ultrafast   (Ultrafast silently runs at normal speed)
+  Standard, Fast
 Pro account
   Standard, Fast, Ultrafast

How a model is decided:

account list names the model?
  yes → offer it, with only the speeds the account list names
  no  → models.dev plan list, as before
account list not loaded yet or failed → models.dev plan list, as before

The account list never hides a model on its own. When GPT-6.1 Sol launched, /v1/models left it out for some accounts for days (#52878), which is why full syncing was turned off in #53466. A model it doesn't name still follows the plan list. A model it names that the plan list doesn't have is offered, as long as the OpenAI catalog has it.

The lists load in the background through ProviderRefresh.start and SharedCache, like the Copilot and DigitalOcean lists: at startup, on an account switch and every 10 minutes, reloading providers only when the list changed.

  • Codex: GET https://chatgpt.com/backend-api/codex/models?client_version=99.0.0. The endpoint requires client_version and hides models whose minimal_client_version is newer, so it asks as the newest client.
  • Sign in with ChatGPT: GET https://api.openai.com/v1/models, the account list OpenAI documents for this route.

The shared part is packages/core/src/plugin/provider/openai-account-models.ts. This also removes the commented-out /v1/models sync it replaces from chatgpt.ts.

How did you verify your code works?

  • Live, on a Plus account: both endpoints return { models: [{ slug, visibility, supported_in_api, service_tiers: [{ id }] }] }, and every listed model has only priority. The Codex endpoint returns 400 without client_version.
  • New tests in provider-openai.test.ts and provider-chatgpt.test.ts: the account list removes a speed the plan list has, adds one it lacks, adds a model only it lists, and leaves a model it omits to the plan list. Existing tests now serve an unavailable list instead of reaching the network.
  • bun run check passes. The changed test files pass with --rerun-each 10.

Not verified live: a Pro account's list. The /v1/models dump from a Pro $200 account in #64968 lists priority and ultrafast for gpt-6.2-sol, which is what this matches. The Codex list for a Pro account is unconfirmed.

Screenshots / recordings

Not a UI change.

Checklist

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

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sound. I read the diff against ProviderRefresh.start, SharedCache and how models.dev names speeds. The changed test files pass (34/34) and tsc -b for packages/core passes. I couldn't run either sign-in live without ChatGPT credentials.

Public API: unchanged. The new endpoints are internal fetches, with no new config, flags or plugin API.

On the Pro case you couldn't check: a user's dump of /v1/models from a Pro $200 account in #64968 shows service_tiers IDs priority and ultrafast for gpt-6.2-sol (and only priority for gpt-6.2-astra). That is exactly what allowed matches, so Ultrafast should come back for eligible Sign in with ChatGPT accounts. The Codex list's tier IDs for a Pro account are still unconfirmed.

No blocking concerns.

Fixes #64968
Related: #64528, #52878

This branch has not been deployed

No deployments
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.

[FEATURE]: Show GPT-6.2 Ultrafast for eligible ChatGPT Pro accounts

1 participant