Skip to content

feat(core): read the ChatGPT plan model lists from models.dev - #65579

Merged
rekram1-node merged 7 commits into
devfrom
chatgpt-model-lists
Nov 22, 2026
Merged

rekram1-node merged 7 commits into
devfrom
chatgpt-model-lists

Conversation

@rekram1-node

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

Copy link
Copy Markdown
Member

Issue for this PR

None

Type of change

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

What does this PR do?

The model lists for the two ChatGPT-plan sign-ins (Codex and Sign in with ChatGPT) are hardcoded, so every change needs a release. This reads them from models.dev instead, so they update within the catalog's 5 minute refresh.

models.dev lists them as two hidden providers, openai-codex and openai-chatgpt, only returned with ?include= (anomalyco/models.dev#14216). They never become providers here: users still see one openai provider.

 catalog request: /experimental/v2.0/api.json?type=chat,...
+                 &include=openai-codex,openai-chatgpt
 reading the catalog:
   each provider → a provider
+  openai-codex, openai-chatgpt → skipped as providers; their model IDs (fast modes included)
+                                 attached to the openai entry as subscriptions
 Codex sign-in (openai.ts):
-  enable gpt models newer than 5.5, minus a deny list, plus gpt-image-2
+  enable exactly the Codex list's models; the old rules when the list is missing
 Sign in with ChatGPT (chatgpt.ts):
-  built-in list of IDs
+  the catalog's list; the built-in one when the list is missing

The list is missing when the catalog came from an older cache, the bundled snapshot from before the lists existed, or a custom mirror; then the old rules apply.

Merge order: this needed anomalyco/models.dev#14216 deployed first, because the live catalog had an older 2-model openai-codex list. It's now merged and deployed. Running this PR's reader on the live catalog attaches 21 Codex IDs and 22 Sign in with ChatGPT IDs (fast modes included) to openai, every one of them an existing openai model, and adds no new providers.

openai-subscription-models.ts keeps each plugin's copy of its list and rebuilds providers when a catalog refresh changes it. A plugin's provider changes run synchronously, so they can't read the catalog at that moment. It's a temporary, OpenAI-only stopgap until opencode moves to the official v2 models.dev API, which returns these lists by default. It reads once more after subscribing, so a refresh that lands during startup isn't missed. It reads the same catalog view as the models.dev plugin, so there's still one fetch and one cache.

The bundled catalog (snapshot.txt) is regenerated from this PR's URL, so it carries both lists from the first launch. It can't land separately first: fetched with dev's URL it has no lists, and with the lists dev would register them as providers.

Context limits (openai-context-caps.ts) are unchanged: the 272k/500k caps are a plan-usage choice, not something the lists carry.

No flag: it only changes which models are listed, and it ships after the models.dev lists are live.

gpt-5.5 and gpt-5.5-fast are removed from the built-in Sign in with ChatGPT list: tested live, that route rejects gpt-5.5 ("not supported when using Codex with a ChatGPT account") and GET /v1/models doesn't list it. models.dev dropped it in anomalyco/models.dev#14267, and the bundled catalog is regenerated after that deploy.

How did you verify your code works?

  • New tests:
    • The hidden lists are attached to openai and never returned as providers.
    • Codex sign-in enables exactly the listed models (including gpt-image-2, not -pro), and follows a refresh that changes the list.
    • Sign in with ChatGPT uses the catalog's list over the built-in one.
  • bun typecheck in packages/core.
  • Full packages/core suite: 7931 pass, 3 fail. The same 3 shell tests fail without this 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.

The code is sound, but it shouldn't merge before anomalyco/models.dev#14216 is deployed. The live catalog already serves an old openai-codex list.

I fetched the live catalog using the URL this PR builds and ran the PR's parser on it. openai.plans comes out as { "openai-codex": ["gpt-6.1-sol", "gpt-6.1-terra"] }. With this change, Codex sign-in would offer only those two models and drop gpt-6-sol, the gpt-6.2-* models, gpt-image-2 and the rest that the current version rule allows. So "nothing changes for users until the models.dev PR is deployed" only holds for openai-chatgpt. Either merge after the models.dev deploy, or guard against the old list.

I couldn't try a real sign-in because there are no credentials. The 3 affected test files pass (63 tests) and tsc passes.

Public API: unchanged. Snapshot.plans is an optional internal field, and the catalog request only gains an include= query parameter.

There is also a small timing gap when the list tracker starts (inline).

@rekram1-node

Copy link
Copy Markdown
Member Author

Both fixed: the list tracker reads again after subscribing, and the description now says to merge after anomalyco/models.dev#14216 is deployed, since the live catalog still has the old 2-model Codex list.

@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.

The new commit fixes the startup timing gap: the tracker now reads the catalog once more after it subscribes, like ModelsDevPlugin does. The 3 affected test files still pass (63 tests) and tsc passes. I still couldn't try a real sign-in because there are no credentials.

The Codex merge-order concern is now covered only by the note in the description, so it still depends on models.dev#14216 being deployed before this merges.

The public API is unchanged.

@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.

The Codex merge-order concern is resolved. models.dev#14216 is live, and I ran this PR's catalog reader on both the live catalog and the regenerated snapshot.txt. Both give 21 Codex IDs (now including gpt-image-2, the gpt-6* and gpt-5.6-* models and their fast modes) and 22 Sign in with ChatGPT IDs. All of them are existing openai models, and no extra providers appear. I couldn't try a real sign-in because there are no credentials.

The 3 affected test files pass (63 tests) and tsc passes. Nothing new to raise.

The public API is unchanged.

@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.

The new commit is a sound guard: an empty catalog list now falls back to the built-in rules instead of hiding every model. The 3 affected test files pass (63 tests) and tsc passes. I couldn't try a real sign-in because there are no credentials. Nothing new to raise.

The public API is unchanged.

@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.

The latest commit renames and re-comments the code without changing behaviour. The 3 affected test files pass (63 tests) and tsc passes. I couldn't try a real sign-in because there are no credentials. Nothing new to raise.

The public API is unchanged.

@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.

The latest commit renames internal names and flattens the list setup without changing behaviour. The 3 affected test files pass (63 tests) and tsc passes. I couldn't try a real sign-in because there are no credentials. Nothing new to raise.

The public API is unchanged.

@rekram1-node
rekram1-node merged commit 43b1015 into dev Nov 22, 2026
12 checks passed
@rekram1-node
rekram1-node deleted the chatgpt-model-lists branch November 22, 2026 17:46

@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.

The latest commit drops gpt-5.5 and gpt-5.5-fast from Sign in with ChatGPT's built-in list. That matches the regenerated snapshot.txt, whose Sign in with ChatGPT list now has the same 20 IDs. The 3 affected test files pass (63 tests) and tsc passes. I couldn't confirm the live rejection because there are no credentials. Nothing new to raise.

The public API is unchanged.

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.

1 participant