Command Code with AI Gateway
Use Command Code with AI Gateway for model access and spend monitoring. Command Code's bring your own key (BYOK) configuration, currently in beta, lets you set a custom provider endpoint and choose models.
Command Code requires manual configuration. The Vercel CLI setup command does not configure it.
With Node.js 22 or later installed, run:
Terminalnpm i -g command-code@latest command-code --versionThe second command prints the installed version. See the Command Code installation instructions for platform-specific details.
If you haven't signed in to Command Code, run:
Terminalcommand-code loginComplete the sign-in in your browser, then return to the terminal after Command Code confirms the login.
Create an AI Gateway API key and export it in the terminal where you run Command Code:
Terminalexport AI_GATEWAY_API_KEY="your-ai-gateway-api-key"Replace
your-ai-gateway-api-keywith your key.Create
~/.commandcode/providers.jsonwith the following configuration. If the file exists, add thevercelentry to itsproviderobject:~/.commandcode/providers.json{ "provider": { "vercel": { "name": "Vercel AI Gateway", "baseURL": "https://ai-gateway.vercel.sh/coding-agent/v1", "apiKey": "$AI_GATEWAY_API_KEY", "models": { "deepseek/deepseek-v4.1-flash": {} } } } }The
baseURLuses the coding agent endpoint. Command Code uses OpenAI-compatible Chat Completions by default. Add an entry undermodelsfor each model you want to use, with its AI Gateway model ID.Start a session in the same terminal:
Terminalcommand-codeRun
/modeland select a model under Vercel AI Gateway. Requests for that model route through AI Gateway. Reopen/modelafter editingproviders.jsonto load your changes.Send a prompt, then check AI Gateway logs to verify the request.
Was this helpful?