Claude Code without a subscription: connecting via API key

Claude Code works with a plain API key, not only with a subscription. Then you pay for the tokens you used, not for a month.

2 min · 5 September 2026 · claude-code · subscriptions · setup

By default Claude Code asks you to sign in to an Anthropic account and runs on a subscription. That is not the only mode: the agent can talk to any compatible API using a key. The difference matters — you pay for what you actually consumed and never hit a plan's quota.

How the modes differ

A subscription is a fixed monthly sum plus quotas that reset on a schedule. When the quota runs out the agent stops, and nothing you do speeds that up.

A key is a balance. You work as long as the money lasts and top up when it does not. No weekly windows — but no "unlimited" either: every request costs money, and intensive work adds up quickly. That is exactly why the per-token price matters.

Setup

Claude Code reads ~/.claude/settings.json on every start. On Windows the file lives at %USERPROFILE%\.claude\settings.json.

bash
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.zukko.pro",
    "ANTHROPIC_AUTH_TOKEN": "fetch_your_key"
  }
}

Two details trip people up most often.

The URL takes no /v1. Claude Code appends the path itself. Write https://api.zukko.pro/v1 and your requests land on a path that does not exist, returning a 404.

Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. The first is sent as a Bearer token; the second tells Claude Code you have an official account, and it starts asking you to log in.

If settings.json already exists, add the env block inside it rather than replacing the whole file.

Model slots

Claude Code's /model menu has three fixed slots — Opus, Sonnet, Haiku. You can point them at specific models:

bash
{
  "env": {
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
  }
}

This is a convenient cost lever: keep a cheaper model on the Sonnet slot and switch to Opus only where you need full strength.

A one-off run

To try it without touching your config:

bash
export ANTHROPIC_BASE_URL="https://api.zukko.pro"
export ANTHROPIC_AUTH_TOKEN="fetch_your_key"
claude

The variables live until you close the terminal.

The VS Code extension

The extension reads the same ~/.claude/settings.json. Additionally enable Claude Code: Disable Login Prompt in VS Code settings, or it will keep offering an Anthropic sign-in, then reload the window.

What breaks most often

It asks you to sign in to Anthropic. The token is not visible: check the variable is named ANTHROPIC_AUTH_TOKEN, and that your JSON has no trailing comma — one quietly invalidates the whole file.

401 invalid_api_key. A typo in the key, a revoked key, or whitespace around it.

402. An empty balance; requests are not sent.

404 on every request. Almost always a stray /v1 in the URL.

What it costs

Through Zukko, Claude Opus 5 runs at $0.30 per million tokens against Anthropic's $5 input and $25 output. For agent work, where a session burns hundreds of thousands of input tokens, the gap is substantial.

Keys are issued in the dashboard, and signing in to @zukkopro_bot credits $1 — enough to run Claude Code on your own task and see what it actually consumes for you.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

Claude Code without a subscription: API key setup · Zukko