DEV Community

Hoàng Văn Anh Nghĩa
Hoàng Văn Anh Nghĩa

Posted on

How I use AmpCode for free

How I Use AmpCode for Free

I like AmpCode. It works both in the terminal and as a VS Code extension, and it gets out of my way. But the credit system adds up — especially when you're running long coding sessions with Claude Opus or GPT-5.

Then I realized something: I already have Claude Code, OpenAI Codex CLI, and Gemini CLI — all free, all with generous API quotas through OAuth. AmpCode is just calling the same models through the same APIs.

So I built a proxy that sits between AmpCode and the AI providers, swapping AmpCode's paid credentials for my existing free ones.

The idea

AmpCode → ampcode-connector (localhost) → Claude Code OAuth   (free)
                                        → OpenAI Codex OAuth  (free)
                                        → Gemini CLI OAuth    (free)
                                        → AmpCode upstream    (paid, last resort)
Enter fullscreen mode Exit fullscreen mode

When AmpCode asks for Claude Sonnet, the proxy intercepts the request and forwards it to api.anthropic.com using the OAuth token from my Claude Code subscription. Same model, same response — zero credits spent.

If no local provider is available, the request falls through to AmpCode's servers as normal. You never lose access, you just stop paying for what you already have.

Setup takes 30 seconds

bunx ampcode-connector setup    # points AmpCode at the proxy
bunx ampcode-connector login    # opens browser for OAuth
bunx ampcode-connector          # start
Enter fullscreen mode Exit fullscreen mode

setup rewrites your AmpCode config to route through localhost:7860. login opens a browser-based OAuth flow for each provider — the same flow you'd use to log into Claude Code or Codex CLI normally. No API keys to copy-paste.

What providers are supported?

Provider Models you get Source
Claude Code Opus 4, Sonnet 4, Haiku Anthropic OAuth
OpenAI Codex CLI GPT-5, o3 OpenAI OAuth
Gemini CLI Gemini Pro, Flash Google OAuth

Each provider uses standard PKCE OAuth — the same auth flow that Claude Code and Codex CLI use internally.

The routing is smarter than you'd think

A simple proxy would just forward requests. ampcode-connector does more:

Thread affinity. Once a thread starts on a specific account, it stays there. This avoids context confusion when you have multiple accounts logged in.

Least-connections balancing. New threads go to the account with the fewest active threads. If you log in with 3 Google accounts, they get used evenly.

Rate limit handling. When a provider returns 429, the proxy automatically retries with a different account or quota pool. The failed account goes on cooldown.

Google cascade. Google gives you two separate quota pools — Gemini CLI and Antigravity (Vertex AI). The proxy tries both before giving up, effectively doubling your free tier.

Request in → local OAuth available?
  yes → forward to provider API (free)
    429? → retry different account/pool
    401? → fall through
  no → forward to ampcode.com (paid)
Enter fullscreen mode Exit fullscreen mode

Multi-account stacking

This is the part I like most. You can log in multiple times per provider:

bunx ampcode-connector login google    # account 1
bunx ampcode-connector login google    # account 2
bunx ampcode-connector login google    # account 3
Enter fullscreen mode Exit fullscreen mode

Each account has its own rate limit quota. Three Google accounts = 3x the free tier. The proxy balances across all of them automatically.

What it doesn't touch

The proxy only intercepts AI model requests (/api/provider/...). Everything else — authentication, threads, telemetry, settings — passes through to ampcode.com untouched. AmpCode doesn't know the proxy exists.

Is this allowed?

You're using your own subscriptions to call APIs you already have access to. The proxy doesn't bypass any paywalls or share credentials. It just routes your AmpCode requests through OAuth tokens that belong to you.

Try it

bunx ampcode-connector setup
bunx ampcode-connector login
bunx ampcode-connector
Enter fullscreen mode Exit fullscreen mode

Source: github.com/nghyane/ampcode-connector


If you're using AmpCode and already have Claude Code, Codex CLI, or Gemini CLI — you're paying twice for the same models. This fixes that.

Top comments (0)