Skip to content
Docs

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:

terminal
npx vercel ai-gateway setup --agent continue

The 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:

  1. Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.

  2. Continue resolves its secrets syntax from environment variables. Export the key in your shell:

    Terminal
    export AI_GATEWAY_API_KEY="your-ai-gateway-api-key"

    To persist the key, add the same line to your shell's startup file.

  3. Add a gateway model to the models array in ~/.continue/config.yaml:

    ~/.continue/config.yaml
    name: 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 the AI_GATEWAY_API_KEY environment variable at runtime, so the key never lands in the file. cn launches with the first entry in the list, so put your preferred model first.

  4. If cn has never run before, create the onboarding marker next to the config so the interactive onboarding doesn't rewrite your models:

    Terminal
    touch ~/.continue/.onboarding_complete

    If cn ever 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.

  5. Terminal
    cn

    Switch models with /model. Add more gateway models to the models array the same way, each with the same apiBase and 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.

VariableDescription
AI_GATEWAY_API_KEYYour AI Gateway API key, read through ${{ secrets.AI_GATEWAY_API_KEY }}. Required

Continue calls AI Gateway through the OpenAI-compatible Chat Completions API, so any model that supports Chat Completions works.

Last updated September 13, 2026

Was this helpful?

supported.