feat(providers): add Command Code preset with live model discovery - #923
Conversation
📝 WalkthroughWalkthroughThe provider registry adds Command Code with key authentication, OpenAI-compatible routing, bounded live model discovery, and unknown API-key validation. Tests cover configuration, discovery, routing, fallback behavior, and parity. English and localized documentation update provider counts and Command Code usage details. ChangesCommand Code provider
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant OpenCodex
participant CommandCodeModels
participant CommandCodeChat
OpenCodex->>CommandCodeModels: GET /provider/v1/models
CommandCodeModels-->>OpenCodex: Return bounded model catalog
OpenCodex->>CommandCodeChat: POST /provider/v1/chat/completions with bearer key
CommandCodeChat-->>OpenCodex: Return OpenAI-compatible completion
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Line 193: Update the catalog introduction in
docs-site/src/content/docs/guides/providers.md:193-193 and its translations in
docs-site/src/content/docs/ja/guides/providers.md:122-122,
docs-site/src/content/docs/ko/guides/providers.md:122-122,
docs-site/src/content/docs/ru/guides/providers.md:129-129, and
docs-site/src/content/docs/zh-cn/guides/providers.md:114-114 to state that key
validation is provider-specific and Command Code keys are reported as
unverifiable.
- Around line 277-283: Update the Command Code provider documentation to remove
or explicitly mark the Go/Pro CLI auth bridge as not yet available in
docs-site/src/content/docs/guides/providers.md lines 277-283,
docs-site/src/content/docs/ja/guides/providers.md lines 200-206,
docs-site/src/content/docs/ko/guides/providers.md lines 200-206,
docs-site/src/content/docs/ru/guides/providers.md lines 209-215, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193, preserving
the remaining authentication guidance in each locale.
In `@src/providers/registry.ts`:
- Line 1195: Update the note in the provider registry entry to state that API
access requires the Provider plan and that CLI auth bridging for Go/Pro
subscribers is not yet available; remove wording that implies the bridge
currently provides access.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1a0bbdd9-4bae-4a47-bb65-d54620045ecb
📒 Files selected for processing (16)
docs-site/src/content/docs/getting-started/quickstart.mddocs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ja/getting-started/quickstart.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/getting-started/quickstart.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/getting-started/quickstart.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/getting-started/quickstart.mddocs-site/src/content/docs/zh-cn/guides/providers.mdsrc/oauth/key-providers.tssrc/providers/derive.tssrc/providers/registry.tstests/commandcode-provider.test.tstests/fixtures/commandcode-models.jsontests/provider-registry-parity.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adae0d925d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Seed the default model so discovery failure never empties the catalog - Correct preset counts in all locales (69: 58 key, 7 OAuth, 3 local, 1 forward) - State key validation is provider-specific (Command Code: unverifiable) - Drop the not-yet-available CLI auth bridge claim; add docs URL + verification date
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs-site/src/content/docs/guides/providers.md (1)
278-284: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDocument the complete Command Code provider contract in every locale.
The five sections describe discovery and Bearer authentication, but they do not explicitly document key authentication with
openai-chat,POST {baseUrl}/chat/completions, or the unavailability of OAuth/CLI bridging.
docs-site/src/content/docs/guides/providers.md#L278-L284: add theopenai-chatadapter,POST \https://api.commandcode.ai/provider/v1/chat/completions\``, and explicit OAuth/CLI bridge-unavailable wording.docs-site/src/content/docs/ja/guides/providers.md#L201-L207: add the equivalent Japanese details.docs-site/src/content/docs/ko/guides/providers.md#L201-L207: add the equivalent Korean details.docs-site/src/content/docs/ru/guides/providers.md#L210-L216: add the equivalent Russian details.docs-site/src/content/docs/zh-cn/guides/providers.md#L188-L193: add the equivalent Simplified Chinese details.As per path instructions, provider documentation must match actual CLI/API behavior and document the Command Code
openai-chatcontract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs-site/src/content/docs/guides/providers.md` around lines 278 - 284, Update the Command Code provider sections in docs-site/src/content/docs/guides/providers.md (278-284), docs-site/src/content/docs/ja/guides/providers.md (201-207), docs-site/src/content/docs/ko/guides/providers.md (201-207), docs-site/src/content/docs/ru/guides/providers.md (210-216), and docs-site/src/content/docs/zh-cn/guides/providers.md (188-193) to document the openai-chat adapter, key-authenticated POST https://api.commandcode.ai/provider/v1/chat/completions requests, and explicitly state that OAuth/CLI authentication bridging is unavailable; provide equivalent localized wording in each translated section while preserving the existing discovery and Bearer-auth details.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 193-196: Make the built-in provider breakdown explicitly state one
default ChatGPT-forward preset while preserving totals of 69, 58 key-based, 7
OAuth, 3 local, and 1 ChatGPT-forward: update
docs-site/src/content/docs/guides/providers.md lines 193-196,
docs-site/src/content/docs/ru/guides/providers.md lines 129-132, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 114-116 with each
locale’s equivalent of an explicit count of one.
---
Outside diff comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 278-284: Update the Command Code provider sections in
docs-site/src/content/docs/guides/providers.md (278-284),
docs-site/src/content/docs/ja/guides/providers.md (201-207),
docs-site/src/content/docs/ko/guides/providers.md (201-207),
docs-site/src/content/docs/ru/guides/providers.md (210-216), and
docs-site/src/content/docs/zh-cn/guides/providers.md (188-193) to document the
openai-chat adapter, key-authenticated POST
https://api.commandcode.ai/provider/v1/chat/completions requests, and explicitly
state that OAuth/CLI authentication bridging is unavailable; provide equivalent
localized wording in each translated section while preserving the existing
discovery and Bearer-auth details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5eca9229-02ec-4a59-aa5d-0a34beb41b87
📒 Files selected for processing (12)
docs-site/src/content/docs/getting-started/quickstart.mddocs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ja/getting-started/quickstart.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/getting-started/quickstart.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/getting-started/quickstart.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/getting-started/quickstart.mddocs-site/src/content/docs/zh-cn/guides/providers.mdsrc/providers/registry.tstests/commandcode-provider.test.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs-site/src/content/docs/guides/providers.md (1)
278-284: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDocument the
openai-chatadapter in every Command Code guide.The three guides document the endpoint and authentication behavior but leave the provider’s adapter implicit. Add the
openai-chatadapter name in each Command Code section.
docs-site/src/content/docs/guides/providers.md#L278-L284: state that Command Code uses theopenai-chatadapter.docs-site/src/content/docs/ru/guides/providers.md#L210-L216: state that Command Code uses theopenai-chatadapter.docs-site/src/content/docs/zh-cn/guides/providers.md#L188-L193: state that Command Code uses theopenai-chatadapter.As per path instructions, document Command Code as a key-based provider using the
openai-chatadapter.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs-site/src/content/docs/guides/providers.md` around lines 278 - 284, Document Command Code as a key-based provider using the openai-chat adapter in docs-site/src/content/docs/guides/providers.md lines 278-284, docs-site/src/content/docs/ru/guides/providers.md lines 210-216, and docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193; update each Command Code section while preserving its existing endpoint and authentication details.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Around line 278-284: Document Command Code as a key-based provider using the
openai-chat adapter in docs-site/src/content/docs/guides/providers.md lines
278-284, docs-site/src/content/docs/ru/guides/providers.md lines 210-216, and
docs-site/src/content/docs/zh-cn/guides/providers.md lines 188-193; update each
Command Code section while preserving its existing endpoint and authentication
details.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 15ad58a4-e293-4c0a-9201-c39148442e84
📒 Files selected for processing (3)
docs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/guides/providers.md
[shipping-github] MergeWhy it helps: Fixes #909. |
Summary
commandcoderegistry preset: OpenAI-compatibleopenai-chatprovider athttps://api.commandcode.ai/provider/v1, API-key auth, dashboard link, and live model discovery from the public/provider/v1/modelscatalog (51 models, slash-namespaced ids preserved, context windows parsed). Default model:deepseek/deepseek-v4-flash, also seeded as the cold-start fallback so a discovery failure never empties the catalog for a fresh config.apiKeyValidation: "unknown"so validation reports "couldn't validate (may still work)" instead of a false positive; the docs now state validation is provider-specific.PROVIDER_REGISTRY.Validation
bun run typecheck— passbun test tests/commandcode-provider.test.ts tests/provider-registry-parity.test.ts— 39 pass, 0 fail (includes the new discovery-failure fallback regression test)bun run test— 7561 tests; 14 fail, all reproduced identically on the upstreamdevtip (Windows symlinkEPERM+ a cmd-shim spawn assertion), unrelated to this changebun run privacy:scan— passGET https://api.commandcode.ai/provider/v1/models— 200, 51 rows (fixture snapshot);POST /provider/v1/chat/completionswithout a key returns401 UNAUTHORIZEDwith an official error-docs linkPrimary-source evidence (per
MAINTAINERS.md/ contributing)/provider/v1/modelsis public by design — verified 200 with and without a key, so there is no authenticated models endpoint to cite for this provider (the entry'sliveModelsreads the public catalog).MAINTAINERS.md) — updates land through the existing provider-registry review flow.Review notes
preserveCustomDestination: truekeeps the registry from retargeting an existing same-named custom provider, including the local-bridge workaround from the issue.reasoningEfforts: []keeps unknown models off Codex's fallback ladder until Command Code publishes a per-model reasoning contract.apiKeyValidationfield overlaps with open PR feat(providers): add SambaNova and Nebius presets #870 (SambaNova/Nebius), which introduces the same policy; whichever lands second needs only a trivial rebase.Limitations
403 MODEL_NOT_IN_PLAN) are passed through from upstream; no client-side per-plan filtering is applied.Fixes #909
Summary by CodeRabbit