Feat/opus5 support - #216
Open
MarkZhang777 wants to merge 2 commits into
Open
Conversation
…ding it The model lists in shared/modelConstants.js are hand-maintained, so every time a CLI ships a new model somebody has to notice and send a patch — and until they do the picker offers models that no longer exist while hiding the ones that do. That drift is already real. codex-cli 0.145.0 serves gpt-5.6-sol, gpt-5.4-mini and gpt-5.3-codex-spark; the pinned list still offered gpt-5.6, o3 and o4-mini. OpenRouter's live catalogue is 342 models including claude-opus-5, against ~60 pinned. This asks the tool instead: - Codex via `codex app-server` line-delimited JSON-RPC (initialize, then model/list with nextCursor pagination) — the same catalogue the Codex CLI's own picker reads. - OpenRouter via its public /api/v1/models endpoint. - Everything else keeps its built-in list; those CLIs expose no equivalent. Discovery is strictly additive and can never make things worse: - Any failure — CLI missing, old, logged out, unresponsive — falls back to the built-in list. The endpoint never rejects, so the picker always renders. - 15s hard timeout per probe, with SIGTERM escalating to SIGKILL so a CLI that traps signals cannot outlive the probe holding its pipes. - Results cached 10 minutes; failures re-tried after 1 minute so the picker recovers on its own once a CLI is installed or logged in. - Concurrent callers collapse onto one probe. Probes carry a generation stamp so a slow superseded probe cannot land last and undo a refresh. - Models in the built-in list that the harness no longer serves stay in the picker, marked deprecated, so a saved preference is never stranded — but if the *selected* model is one of them, the client moves to the harness default rather than submitting a model the harness will reject. New: GET /api/models/:provider (?refresh=1), POST /api/models/:provider/refresh, GET /api/models/providers. The /model slash command now uses the same source. Verified against the real codex CLI end to end: 824ms cold, 3ms cached, correct live list and default. 26 tests drive the real code against a fake harness covering pagination, endless cursors, JSON-RPC errors, non-JSON banner output, silent hangs, multi-byte UTF-8 split across stdout chunks, cache/TTL behaviour, concurrency collapse, and stale-probe ordering. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-opus-5to the Claude model selector