Skip to content
Docs

Junie CLI with AI Gateway

Junie is JetBrains' coding agent, available as a CLI. It loads model profiles from $JUNIE_HOME/models/ (default ~/.junie), which you can point at AI Gateway for unified model access and spend monitoring.

Run the Vercel CLI setup command for Junie CLI:

terminal
npx vercel ai-gateway setup --agent junie

The command writes a stable vercel-ai-gateway profile pinned to the leaderboard's top model, plus one profile per shortlisted gateway model, into $JUNIE_HOME/models/. Each profile contains an environment-variable reference to AI_GATEWAY_API_KEY that resolves when the profile loads. Re-run the command to refresh the shortlist; profiles from earlier runs stay in place.

If you can't use the Vercel CLI, configure Junie 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. 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. Junie resolves ${AI_GATEWAY_API_KEY} in a profile when the profile loads, so the key never lands in the file.

  3. Create ~/.junie/models/vercel-ai-gateway.json:

    ~/.junie/models/vercel-ai-gateway.json
    {
      "id": "openai/gpt-6-astra",
      "displayName": "GPT-6 Astra",
      "providerName": "Vercel AI Gateway",
      "baseUrl": "https://ai-gateway.vercel.sh/coding-agent/v1/chat/completions",
      "apiType": "OpenAICompletion",
      "apiKey": "${AI_GATEWAY_API_KEY}",
      "maxContextLength": 1050000
    }

    The id is the gateway model the profile selects. Change it to any gateway model ID, and adjust maxContextLength to match.

    For a picker entry per model, write additional profile files named vercel-<gateway-model-id>.json (dashes replacing / and other punctuation), each with that model's id and display name. They group under Vercel AI Gateway in /model after the built-in providers.

  4. Terminal
    junie --model custom:vercel-ai-gateway

    Or pick the model with /model in a session. The stable profile defaults to the model in its id.

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 ${AI_GATEWAY_API_KEY}. Required
JUNIE_HOMEOverrides the profiles directory. Defaults to ~/.junie

Junie prices custom profiles at 0 in its own reporting. AI Gateway shows the real spend per model in the dashboard.

Last updated September 13, 2026

Was this helpful?

supported.