Claude Code

Connect Claude Code to UnioAPI with two environment variables

Claude Code talks to UnioAPI over Anthropic's official Messages API — no plugin or extra program needed. Set the base URL and your key, code with Claude in the terminal, and look up every call afterwards.

Configure Claude Codebash
export ANTHROPIC_BASE_URL=https://api.unioapi.com
export ANTHROPIC_AUTH_TOKEN="<UNIO_API_KEY>"
# Optional: pick a model; IDs are on the model pages
export ANTHROPIC_MODEL=claude-sonnet-5-5

claude

Don't add /v1 to the base URL. On Windows, set the variables with setx and open a new terminal.

2 variables
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN
/v1/messages
Anthropic's official API
1M
Context window on the latest Claude models
3 platforms
macOS, Linux and Windows

What you get with Claude Code on UnioAPI

Set and go

Set ANTHROPIC_BASE_URL to https://api.unioapi.com and ANTHROPIC_AUTH_TOKEN to your UnioAPI key, start claude and chat — no plugin to install.

Official API, as sent

Claude Code's requests go to POST /v1/messages; tool use, streaming events and anthropic-beta headers all work in the official format.

Caching cuts repeated input

Claude Code resends its system prompt and tool definitions at every step. Once those stable prefixes hit the prompt cache they're billed at cache-read prices, so long sessions are billed noticeably less.

Fast on Opus 5.5

With Fast turned on in Claude Code, requests carry speed: "fast". Opus 5.5 offers Fast as a generally available tier; models without Fast return 400 and nothing is executed or charged.

One key, many tools

The same key works in Codex, Cursor and other tools — or create a dedicated key for Claude Code with its own spend cap and expiry.

Per-call usage

Every model call has its own request log with model, tokens, latency and charge, so you can see where a coding task's usage went.

Set up Claude Code in four steps

  1. Step 1

    Create an API key

    A dedicated key for Claude Code with a spend cap keeps long tasks within budget.

    Read the docs
  2. Step 2

    Install and set the variables

    Install Claude Code with npm, then set the base URL and key; on Windows use setx and open a new terminal.

    Read the docs
  3. Step 3

    Pick a model

    Set ANTHROPIC_MODEL and related variables to a Claude model from the model pages; an unlisted default model returns 404.

    Read the docs
  4. Step 4

    Switch setups in one click

    If you move between several setups, manage them with CC Switch instead of editing environment variables by hand.

    Read the docs

Billed by actual token usage

Every model call Claude Code makes is settled from its response usage: input, output, cache reads and cache writes are priced separately, and Fast has its own prices. The model pages list current prices.

Claude Code setup FAQ

No. Claude Code appends /v1/messages itself; adding /v1 doubles the path and the request returns 404.

Further reading

Related topics

Connect Claude Code to UnioAPI now

Create an API key, set two environment variables and start claude.