APIrove

Home / Docs / Claude Code

TOOL GUIDE · CLAUDE CODE

Use APIrove in Claude Code with a custom API URL

Three environment variables point Claude Code at APIrove for Claude models. You need a Full group key; the URL is https://apirove.com with no /v1.

Updated 2026-11-19 · The /v1/messages endpoint is tested in our release checks; the Claude Code client is not yet tested

What is checked and what is not yet tested

ItemStatus
POST /v1/messages: msg_ ids, type: message, standard stream eventsTested (compatibility check after every release)
Auth: Authorization: Bearer or x-api-keyChecked
Claude is only open to Full group keysChecked (see two key groups)
A full Claude Code session, background model, tool useNot yet tested
Full group keycurl checkSet env varsRun claudeCheck usage
Flow: create a Full group key → check /v1/messages with curl → set environment variables → run claude → check the usage page

Five steps

  1. 1

    Create a Full group key

    After you sign up and add credits, create a Full group key on the keys page. The default Text group key cannot call Claude.

  2. 2

    Check /v1/messages with curl

    Call https://apirove.com/v1/messages with the key. Set up Claude Code once the reply has type message.

  3. 3

    Set the environment variables

    Set ANTHROPIC_BASE_URL to https://apirove.com (no /v1), ANTHROPIC_AUTH_TOKEN to the key and ANTHROPIC_MODEL to a model ID.

  4. 4

    Start Claude Code

    Run claude in the same terminal and send one message.

  5. 5

    Check the usage page

    Confirm a Claude row with a charge appears on the usage page in the console.

Step 2: check /v1/messages with curl

Replace YOUR_API_KEY with a Full group key. A reply with "type": "message" means the key, group and model all work.

POST /v1/messages
export APIROVE_API_KEY='YOUR_API_KEY'

curl https://apirove.com/v1/messages \
  -H "x-api-key: $APIROVE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-5", "max_tokens": 64, "messages": [{"role": "user", "content": "Hello!"}]}'

Model IDs follow the model directory; this page uses claude-sonnet-5 as the example.

Step 3: set the environment variables (Claude Code part not yet tested)

The base URL is the domain only, with no /v1:

ANTHROPIC_BASE_URL
https://apirove.com

macOS / Linux (bash, zsh):

macOS / Linux
export ANTHROPIC_BASE_URL="https://apirove.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="claude-sonnet-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
claude

Windows PowerShell:

Windows PowerShell
$env:ANTHROPIC_BASE_URL="https://apirove.com"
$env:ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
$env:ANTHROPIC_MODEL="claude-sonnet-5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
claude
  • ANTHROPIC_AUTH_TOKEN sends the key as a Bearer token. ANTHROPIC_API_KEY (sent as x-api-key) also works; use one of them.
  • ANTHROPIC_MODEL is the main model.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL is the model Claude Code uses for small background tasks. Set it to a model your key can call so it does not request one your account lacks (not yet tested; older Claude Code versions use ANTHROPIC_SMALL_FAST_MODEL).
If Claude Code on this machine was signed in to another account before, it may prefer that login (not yet tested). On a 401, run /logout inside Claude Code, then start it again with the variables above.

Settings file (optional)

To avoid setting variables each time, put them in ~/.claude/settings.json. The file holds your key, so keep it out of Git.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://apirove.com",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
  }
}

Errors

What you seeUsual causeFix
401Typo, deleted key, or Claude Code used an old loginCopy the key again from the keys page; check with curl; run /logout if needed
403 / model unavailableA Text group keyCreate a Full group key; the URL stays the same
404ANTHROPIC_BASE_URL ends in /v1, or a misspelled model IDUse https://apirove.com; match the model directory
Insufficient balancePrepaid balance is 0Add credits or redeem a code, then retry
429Too many requests or over a limitWait and retry; do not retry in a tight loop

Billing

Every Claude Code request is billed by actual tokens from your prepaid balance; there is no subscription. Input, output, cache read and cache write each have a rate on the pricing page. The rules are in credits and billing, and each charge is on the usage page.

FAQ

Should ANTHROPIC_BASE_URL include /v1?

No. Use https://apirove.com. Claude Code appends /v1/messages itself; https://apirove.com/v1 becomes /v1/v1/messages and usually returns 404.

Why can't a Text group key call Claude?

Claude is only open to the Full group. Create a Full group key on the keys page; the base URL stays the same and old keys can stay.

ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY?

APIrove accepts both: the first sends Authorization: Bearer, the second sends x-api-key. This page uses ANTHROPIC_AUTH_TOKEN. Set only one so the values cannot disagree.

Has Claude Code itself been tested?

Not yet tested. What we check is the /v1/messages endpoint: after every release a compatibility check tests it against the Anthropic Messages format (msg_ ids, standard stream events). Claude Code's own behavior is whatever you see on your machine; send errors and timestamps to help@apirove.com.

Why does Claude Code use more tokens than chat?

Each turn carries project context and tool results, so input tokens are usually higher than in plain chat. Actual tokens are deducted from your prepaid balance; rates, including cache reads and writes, are on the pricing page and every charge is on the usage page.

Start in three steps

Sign up, add credits, then create a key. Every step is in the console.

Related: Cursor guide · Credits and billing · API key security · Models · Pricing

One API for text, image and video output