Skip to content
Rezha Julio
Go back

Unlocking Frontier Power: How to Run Amp Using CLIProxyAPI Without Spending Credits

7 min read

The landscape of AI coding agents is shifting faster than most developers can keep up with. Right now, Amp is sitting at the frontier, offering raw model power that most tools are still trying to figure out. But if you have been using Amp, you know the drill: the “Smart” mode is incredible, but it eats through Amp credits.

If you are already paying for ChatGPT Plus, Claude Pro, or a Google subscription, there is a better way. You can leverage CLIProxyAPI to bridge your existing OAuth subscriptions directly into Amp. This setup effectively allows you to use Amp’s advanced agent features while bypassing the credit consumption by routing requests through your own authenticated quotas.

Here is how to set up this “pro-tier” bridge to get unconstrained token usage with the best models on the market.

Why CLIProxyAPI?

At its core, CLIProxyAPI is a proxy server designed to connect CLI models to an API setup compatible with platforms like OpenAI, Gemini, and Claude. It acts as a universal adapter, allowing you to call these models through standard API requests rather than just terminal commands.

The magic happens with the specialized Amp CLI integration. CLIProxyAPI includes specialized routing that supports Amp’s unique API patterns while maintaining compatibility with standard features. It maps Amp’s specific provider patterns—like /api/provider/{provider}/v1...—to its own internal handlers.

The architecture is simple but powerful:

  1. Request Received: Amp sends a request to your local proxy.
  2. Local Check: The proxy checks if you have configured an OAuth token for that model locally.
  3. Routing: If the model is authenticated (via your subscription), it uses your local OAuth tokens. If not, it falls back to Amp’s backend, which then requires Amp credits.

Step 1: Installing the Infrastructure

Before you can bridge your accounts, you need to get CLIProxyAPI running. You have a few options, but building from source or using the pre-compiled binaries is most common for dev environments.

Building from Source

You will need Go 1.24 or higher.

Terminal window
git clone https://github.com/router-for-me/CLIProxyAPI.git
cd CLIProxyAPI
go build -o cli-proxy-api ./cmd/server

This gives you the cli-proxy-api executable. If you are on macOS, you can also use Homebrew: brew install cliproxyapi.

Step 2: Authenticating Your Subscriptions

This is the most critical step. To use Amp “for free” (using your existing subscriptions), you must authenticate the providers Amp relies on. Amp employs different models for various agent roles:

Run the following commands to log in via OAuth:

If you’re using Github Copilot, you need to use https://github.com/router-for-me/CLIProxyAPIPlus. This one doesn’t have a ready to use build via homebrew so you may need to manually download from release page or just build it yourself.

Once you log in through the browser window that pops up, the system saves your tokens in the ~/.cli-proxy-api directory. This enables the proxy to use your included usage quotas rather than Amp’s backend.

Step 3: Configuring the Proxy for Amp

You need a config.yaml file to tell the proxy how to communicate with Amp’s control plane for management tasks like thread sharing and user authentication.

Create or edit your config.yaml with the following block:

port: 8317
api-keys:
- "your-secret-key" # You create this key for Amp to talk to the proxy
debug: true
quota-exceeded:
switch-project: true
switch-preview-model: true
ampcode:
upstream-url: "https://ampcode.com"
restrict-management-to-localhost: true # Extra security for your local machine

Step 4: Pointing Amp to Your Local Proxy

Now that the proxy is ready, you need to tell the Amp CLI to stop talking to the cloud and start talking to localhost. You can do this via environment variables or settings files.

Using Environment Variables

This is the fastest way to test the setup:

Terminal window
export AMP_URL=http://localhost:8317
export AMP_API_KEY=your-secret-key

With these set, the standard amp login command is no longer necessary.

Using Settings Files

For a permanent setup, edit your Amp configuration:

  1. URL: In ~/.config/amp/settings.json, set "amp.url": "http://localhost:8317".
  2. Key: In ~/.local/share/amp/secrets.json, set "apiKey@http://localhost:8317": "your-secret-key".

Step 5: Validating the Connection

Start your proxy:

Terminal window
./cli-proxy-api --config config.yaml

Now, run a command in Amp:

Terminal window
amp "Analyze the current directory and find all markdown files"

If your proxy logs show requests hitting /api/provider/google/... or /api/provider/openai/... and being handled locally, you are successfully using your own subscription.

The Fallback Safety Net

One of the best features of this integration is the Model Mapping. If Amp requests a model you don’t subscribe to, it will automatically map it to a another model you map to. This ensures Amp never breaks. Here is my mapping.

model-mappings:
# Model requested by Amp CLI Smart mode
- from: "claude-opus-4.5"
to: "gemini-claude-opus-4-5-thinking" # routed to antigravity
- from: "claude-opus-4-5-20251101"
to: "gemini-claude-opus-4-5-thinking"
# Model requested by Amp CLI Rush mode
- from: "claude-haiku-4-5-20251001"
to: "gemini-3-flash-preview"
# model requested by AMP CLI Oracle/Librarian/Review mode
- from: "gemini-2.5-flash-lite-preview-09-2025"
to: "gemini-3-flash-preview"
- from: "gpt-5"
to: "gemini-3-pro-preview"
- from: "gpt-5.1"
to: "gemini-3-pro-preview"

In fact, for the Smart mode, I sometimes run out of Opus access, so I can swap the gemini-claude-opus-4-5-thinking with gemini-claude-sonnet-4-5 or gemini-3-pro-preview instead.

I made a script to automate changing my configuration.

#!/bin/bash
# Script to switch configuration and set model replacement
if [ $# -lt 1 ]; then
echo "Usage: $0 <model-name> [source-config]"
echo ""
echo "Examples:"
echo " $0 gemini-claude-opus-4-5-thinking"
echo " $0 gemini-claude-sonnet-4-5"
echo " $0 gemini-3-pro-preview"
echo ""
echo "Optional: specify source config file (defaults to config.yaml.template)"
exit 1
fi
MODEL="$1"
SOURCE="${2:-config.yaml.template}"
TARGET="config.yaml"
if [ ! -f "$SOURCE" ]; then
echo "Error: $SOURCE not found"
exit 1
fi
# Replace all occurrences of "replace_this" with the specified model
sed "s/replace_this/$MODEL/g" "$SOURCE" > "$TARGET"
echo "Switched to model: $MODEL"

Create config.yaml.template file like this

port: 8317
api-keys:
- "your-secret-key"
debug: true
quota-exceeded:
switch-project: true
switch-preview-model: true
ampcode:
upstream-url: "https://ampcode.com"
restrict-management-to-localhost: true
model-mappings:
# Model requested by Amp CLI Smart mode
- from: "claude-opus-4.5"
to: "replace_this" # routed to antigravity
- from: "claude-opus-4-5-20251101"
to: "replace_this"
# Model requested by Amp CLI Rush mode
- from: "claude-haiku-4-5-20251001"
to: "gemini-3-flash-preview"
# model requested by AMP CLI Oracle/Librarian/Review mode
- from: "gemini-2.5-flash-lite-preview-09-2025"
to: "gemini-3-flash-preview"
- from: "gpt-5"
to: "gemini-3-pro-preview"
- from: "gpt-5.1"
to: "gemini-3-pro-preview"

Now i just need to run the following commands:

Terminal window
./switch-config.sh gemini-claude-opus-4-5-thinking
./switch-config.sh gemini-claude-sonnet-4-5
./switch-config.sh gemini-3-pro-preview

It replaces all replace_this placeholders in config.yaml.template with your specified model and writes to config.yaml.

The CLIProxyAPI is already watching the config file and will automatically reload the configuration when it changes.

Advanced Usage: IDE Extensions and Security

The beauty of this setup is that it isn’t limited to the terminal. You can use the same proxy for Amp’s IDE extensions in VS Code, Cursor, or Windsurf. Simply open your IDE settings, set the Amp URL to http://localhost:8317, and provide the local API key you configured.

Security Hardening

Since you are running a proxy that handles sensitive OAuth tokens, security is paramount.

Frontier Power, Your Terms

By using CLIProxyAPI as a bridge, you turn Amp into a truly unconstrained tool. You get to keep Amp’s four core principles—unconstrained token usage, always using the best models, raw model power, and a system built to evolve—while leveraging the subscriptions you already pay for.

Whether you are using the Oracle for deep reasoning on a complex bug or spawning subagents to refactor five files at once, this setup ensures that the only thing you are focused on is the code, not the credit balance.



Previous Post
Automating My Blog Workflow with Bun
Next Post
Migrating from Hugo to Zola