How I use AmpCode for free
Source: Dev.to
The idea
AmpCode → ampcode-connector (localhost) → Claude Code OAuth (free)
→ OpenAI Codex OAuth (free)
→ Gemini CLI OAuth (free)
→ AmpCode upstream (paid, last resort)
When AmpCode requests Claude Sonnet, the proxy forwards the request to api.anthropic.com using the OAuth token from your Claude Code subscription. The same model and response are returned—zero credits spent. If no local provider is available, the request falls through to AmpCode’s servers as normal.
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
setuprewrites your AmpCode config to route throughlocalhost:7860.loginlaunches a browser‑based OAuth flow for each provider—identical to the flow used by Claude Code or Codex CLI.- No API keys need to be copied.
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 authentication flow employed by Claude Code and Codex CLI internally.
The routing is smarter than you’d think
A simple proxy would just forward requests. ampcode-connector adds several features:
- Thread affinity – once a thread starts on a specific account, it stays there, avoiding context confusion across multiple accounts.
- Least‑connections balancing – new threads are assigned to the account with the fewest active threads. Logging in with three Google accounts distributes load evenly.
- Rate‑limit handling – on a
429response, the proxy retries with a different account or quota pool, placing the failing account on cooldown. - Google cascade – Google provides two quota pools (Gemini CLI and Vertex AI). The proxy tries both before falling back, effectively doubling the 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)
Multi‑account stacking
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
Each account has its own rate‑limit quota, so three Google accounts give you three times the free tier. The proxy balances across them automatically.
What it doesn’t touch
The proxy only intercepts AI model requests (/api/provider/...). All other traffic—authentication, threads, telemetry, settings—passes directly to ampcode.com. AmpCode remains unaware of the proxy.
Is this allowed?
You are using your own subscriptions to call APIs you already have access to. The proxy does not bypass paywalls or share credentials; it merely routes AmpCode requests through OAuth tokens that belong to you.
Try it
bunx ampcode-connector setup
bunx ampcode-connector login
bunx 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.