Skip to main content
kRouter
All integrations

Use Amp CLI with any AI provider

Sourcegraph Amp coding assistant CLI. Pointing Amp CLI at kRouter gives it 100+ providers behind a single local endpoint — free tiers, subscriptions you already pay for, and paid APIs — with automatic failover when one runs out. Amp CLI is configured through its own settings UI.

Note: Use kRouter model aliases to keep Amp shorthand mappings stable across provider updates.

Heads up: Suggested shorthand examples: g25p → gemini/gemini-2.5-pro, g25f → gemini/gemini-2.5-flash, cs45 → cc/claude-sonnet-4-5-20250929.

Setup

  1. Install Amp

    Install the Amp CLI using the package manager supported by your environment.

  2. API Key

  3. Base URL

    {{baseUrl}}
  4. Select Model

  5. Add Shorthands

    Map Amp shorthand names such as g25p or cs45 to kRouter aliases in your local config.

Commands

bashbash
export OPENAI_API_KEY="{{apiKey}}"
export OPENAI_BASE_URL="{{baseUrl}}"
amp --model "{{model}}"
# Example shorthand aliases you can map locally:
# g25p -> gemini/gemini-2.5-pro
# cs45 -> cc/claude-sonnet-4-5-20250929

Amp CLI documentation

What changes for Amp CLI

Nothing about how you use Amp CLI changes — same interface, same workflow. What changes is where its requests land. Instead of being tied to one vendor and one bill, every request goes through your own machine first and out to whichever provider you mapped: a free tier for routine edits, a subscription you already pay for on the heavy turns, a paid API only when nothing else fits. When one account hits a limit, the next takes over mid-session rather than failing the task. And because the router runs locally, your prompts are not passing through a third-party service on the way.

Troubleshooting Amp CLI

Amp CLI rejects the endpoint URL

Most editors validate the URL by calling it. Make sure kRouter is running first (`krouter -t`), and that you entered the /v1 suffix — the base URL is http://localhost:20128/v1.

It works locally but not from another machine

The default endpoint is loopback-only by design. Enable the tunnel or a cloud endpoint in Settings if the tool needs to reach kRouter over the network.

Amp CLI + kRouter FAQ

Can Amp CLI use providers other than its default?

Yes — that is the point of routing it through kRouter. kRouter presents one OpenAI-compatible endpoint that fans out to 100+ providers, so Amp CLI can reach any of them without knowing they exist.

How is Amp CLI pointed at kRouter?

Through its own settings UI. Nothing about Amp CLI itself changes — it still speaks the same API.

Does routing Amp CLI through kRouter cost anything?

kRouter is free and MIT-licensed and adds nothing to your bill. What you pay is whatever the provider you routed to charges — which is often nothing, if you route to a free tier or a subscription you already hold.

What happens when a provider runs out of quota mid-session?

kRouter parks that account until its real reset time and fails over to the next one you have connected, so Amp CLI keeps working instead of erroring out mid-task.

Get Amp CLI routing in two minutes

kRouter is free, MIT-licensed, and runs entirely on your machine — no account, no proxy in the middle.

Install kRouter