Continue CLI with AI Gateway
Continue is an open-source AI coding agent with a CLI (cn) and IDE extensions. You can configure the CLI to use AI Gateway for unified model access and spend monitoring.
Run the Vercel CLI setup command for Continue CLI:
npx vercel ai-gateway setup --agent continueThe command writes a shortlist of the gateway's most-used models into ~/.continue/config.yaml in leaderboard spend order, references the key through Continue's secrets syntax, and stamps the onboarding marker so an interactive cn doesn't rewrite the config. Re-run it to refresh the shortlist.
If you can't use the Vercel CLI, configure Continue CLI manually:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Continue resolves its secrets syntax from environment variables. Export the key in your shell:
Terminalexport AI_GATEWAY_API_KEY="your-ai-gateway-api-key"To persist the key, add the same line to your shell's startup file.
Add a gateway model to the
modelsarray in~/.continue/config.yaml:~/.continue/config.yamlname: Local Config version: 1.0.0 schema: v1 models: - name: openai/gpt-6-astra provider: openai model: openai/gpt-6-astra apiBase: https://ai-gateway.vercel.sh/coding-agent/v1 apiKey: ${{ secrets.AI_GATEWAY_API_KEY }}apiKey: ${{ secrets.AI_GATEWAY_API_KEY }}is Continue's literal secrets syntax. It resolves theAI_GATEWAY_API_KEYenvironment variable at runtime, so the key never lands in the file.cnlaunches with the first entry in the list, so put your preferred model first.If
cnhas never run before, create the onboarding marker next to the config so the interactive onboarding doesn't rewrite your models:Terminaltouch ~/.continue/.onboarding_completeIf
cnever asks for an Anthropic API key, the marker is missing. Re-create the marker instead of answering the prompt, which would overwrite the gateway models.- Terminal
cnSwitch models with
/model. Add more gateway models to themodelsarray the same way, each with the sameapiBaseand secrets reference.
View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details.
| Variable | Description |
|---|---|
AI_GATEWAY_API_KEY | Your AI Gateway API key, read through ${{ secrets.AI_GATEWAY_API_KEY }}. Required |
- Browse the models catalog for available models
- Configure spend limits on your API key
- Read the Continue documentation for IDE extensions and rules
Was this helpful?