Repository navigation
feat(core): read the ChatGPT plan model lists from models.dev - #65579
Conversation
There was a problem hiding this comment.
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).
|
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Issue for this PR
None
Type of change
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-codexandopenai-chatgpt, only returned with?include=(anomalyco/models.dev#14216). They never become providers here: users still see oneopenaiprovider.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-codexlist. 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) toopenai, every one of them an existingopenaimodel, and adds no new providers.openai-subscription-models.tskeeps 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 withdev's URL it has no lists, and with the listsdevwould 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.5andgpt-5.5-fastare removed from the built-in Sign in with ChatGPT list: tested live, that route rejectsgpt-5.5("not supported when using Codex with a ChatGPT account") andGET /v1/modelsdoesn'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?
openaiand never returned as providers.gpt-image-2, not-pro), and follows a refresh that changes the list.bun typecheckinpackages/core.packages/coresuite: 7931 pass, 3 fail. The same 3 shell tests fail without this change.Checklist