June 29, 20263 min readSetupClaude Code

How to use Claude Code through one API

Claude Code is one of the best terminal agents available, but you don't have to lock yourself into a single billing relationship to use it. With AnyModel you point Claude Code at one OpenAI-compatible endpoint, authenticate with one key, and keep the freedom to switch the underlying model whenever you want.

Why route Claude Code through one API

The usual friction with coding agents is account sprawl: one key for Anthropic, another for OpenAI, a third for Gemini, each with its own dashboard, quota, and invoice. AnyModel collapses that into a single gateway.

  • One endpoint: https://anymodel.org/v1
  • One key reaches every model — GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok.
  • Switching models means changing the model id and nothing else. No new key, no new base URL, no config rewrite.

That last point matters for Claude Code specifically. You can run Sonnet or Opus for day-to-day work and fall back to a different provider for a hard reasoning task or a cheaper bulk job — without leaving your terminal.

Install it in one line

For Claude Code, the fastest path is the official one-line installer. It writes the base URL and your key into the right place automatically:

bash <(curl -fsSL "https://anymodel.org/i?tool=claude") <YOUR_API_KEY>

Replace <YOUR_API_KEY> with the key from your AnyModel dashboard. The same installer supports tool=codex, tool=opencode, and tool=hermes if you use those agents too — just swap the tool= value.

After it finishes, launch Claude Code as you normally would. Requests now flow through AnyModel, and your token usage shows up in one place.

Manual setup for other clients

The one-line installer covers codex, claude, opencode, and hermes only. For everything else — Cursor, Windsurf, Zed, Cline, Aider, Continue, or the Gemini CLI — use a standard OpenAI-compatible configuration:

Setting Value
Base URL https://anymodel.org/v1
API key your AnyModel key
Model any supported id (e.g. a Claude model)

Any tool that speaks the OpenAI Chat Completions format will work with those three values. If you're deciding which model to wire in, the models list shows what's available and the compare page helps you weigh cost against capability.

What it costs to start

You don't need a credit card to try this. New accounts get 1,000,000 free tokens on signup, and you can reach a total of 6,000,000 tokens by linking Telegram. After that it's pay-per-token: no subscription, no monthly minimum, no commitment. You spend only on what you actually send and receive, which suits the bursty nature of coding sessions well.

A note on privacy

By default, your prompts and responses pass through AnyModel like any proxy. If you'd rather they weren't stored on our side, turn on Ghost Mode — an opt-in setting that gives you zero-retention API keys. With it enabled, we keep only a token counter for billing; we don't retain prompts or responses.

Be clear-eyed about what this does and doesn't cover: the model provider on the other end still receives your prompt in order to answer it. Ghost Mode removes our retention, not theirs, so it's honest privacy hygiene rather than a magic shield.

Putting it together

A typical first run looks like this:

  1. Create an account and copy your key.
  2. Run the one-line installer with tool=claude.
  3. Start Claude Code and confirm it responds.
  4. Try a different model id mid-session to see the switch with no other changes.

That's the whole point — the same agent you already like, backed by a model menu you can change on a whim, billed in one place. For more setup walkthroughs and model deep-dives, browse the blog.

Get started

Spin up Claude Code on a single API in a couple of minutes. Create your free AnyModel account, grab your key, and run the installer — your first million tokens are on us.

Read next