feat(ai): add Command Code provider#3357
Conversation
Re-cut from current main — the original PR can1357#3298 had a 3,831-file diff from an old fork point. This cherry-pick contains only the 8 provider- specific files. Adds Command Code as an OpenAI-compatible provider with: - Provider registration in packages/ai/src/registry/ - Catalog descriptor and openai-compat resolution - API key login test coverage
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2183e21d1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ...(apiKey && { | ||
| fetchDynamicModels: () => | ||
| fetchOpenAICompatibleModels({ | ||
| api: "openai-completions", |
There was a problem hiding this comment.
Route Command Code Anthropic models to messages
When Command Code's /models response includes Claude/Anthropic models, this maps every discovered model to the OpenAI chat-completions transport, so selecting one of those models will call /provider/v1/chat/completions. Command Code's provider docs say Anthropic models use /provider/v1/messages and that sending a Claude model to chat completions returns a 400, so those advertised models will be listed but unusable unless they are filtered or mapped to the Anthropic transport. Source checked: https://commandcode.ai/docs/provider-api
Useful? React with 👍 / 👎.
| { | ||
| id: "commandcode", | ||
| defaultModel: "deepseek/deepseek-v4-pro", | ||
| envVars: ["COMMANDCODE_API_KEY"], |
There was a problem hiding this comment.
Recognize Command Code's documented env var
Command Code documents COMMAND_CODE_API_KEY for non-interactive/API-key usage, but the catalog only registers COMMANDCODE_API_KEY, which means users following the provider's docs will not be authenticated through getEnvApiKey/runtime discovery and the provider will appear unavailable until they paste-login or use the nonstandard name. Please support the documented variable, ideally while preserving this alias if desired. Source checked: https://commandcode.ai/docs/studio/api-keys
Useful? React with 👍 / 👎.
Summary
Re-cut of PR #3298 from current main. The original branch had a 3,831-file diff from an old fork point; this cherry-pick contains only the 8 provider-specific files.
Changes
packages/ai/src/registry/commandcode.ts— Command Code as an OpenAI-compatible providerpackages/catalog/src/provider-models/descriptors.ts— provider entry inCATALOG_PROVIDERSpackages/catalog/src/provider-models/openai-compat.ts— model resolution rules for Command Codepackages/ai/test/auth-storage-api-key-login.test.ts— credential storage for Command CodeVerification
bun check— passedimport()calls (addressing review feedback on original PR)Replaces
Closes #3298 (original PR with 3,831-file diff from old fork point)