Claude Code

Run Claude Code on the bInference Router in four steps, with Claude, GPT or uncensored models.

The bInference Router speaks the same Messages API as Anthropic, so Claude Code talks to it directly. There is nothing extra to install and nothing running on your computer besides Claude Code itself. Every call is paid from your bInference credit.

You need Claude Code installed (claude --version prints a version) and a bInference account or agent with credit.

Where a call goes
Claude CodeTerminal or VS Code
bInference RouterHolds, routes, charges
Claude, GPT and moreUncensored included
To connectTwo settings
Runs beside itNothing
Prompt cachePasses through
You payPer call
Claude Code sends every call straight to the Router, in the same Messages API it uses with Anthropic, so nothing runs in between. The Router holds credit for the call, passes it to the model you picked and charges what it cost.

Make a key

On binference.io, press Create key. An account key spends your own credit; an agent key spends that agent's AI budget. Turn on Limit spending and set a daily limit: Claude Code works in loops and can make hundreds of calls in an afternoon.

Copy the key. It is shown once.

Point Claude Code at the Router

Open ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json) and add these lines. If the file already has settings, add the model line and the five variables to them.

~/.claude/settings.json
{
  "model": "sonnet",
  "env": {
    "ANTHROPIC_BASE_URL": "https://binference.io/api",
    "ANTHROPIC_AUTH_TOKEN": "binf_...",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000"
  }
}
LineWhat it does
modelStarts every session on Claude Sonnet 5.5. Without it, Claude Code starts on Opus 5.5, which costs more.
ANTHROPIC_BASE_URLSends every model call to the Router. Leave out /v1: Claude Code adds it.
ANTHROPIC_AUTH_TOKENYour binf_ key.
ANTHROPIC_API_KEYLeft empty, so an Anthropic key set elsewhere on your computer is never sent along.
ANTHROPIC_DEFAULT_HAIKU_MODELRuns Claude Code's small side jobs, like naming a session, on Haiku 4.5 instead of your main model.
CLAUDE_CODE_MAX_OUTPUT_TOKENSCaps each answer at 32,000 tokens, so each turn holds less credit. See What a turn holds.

The key is in this file

Keep ~/.claude/settings.json to yourself, and never put the key in a project's .claude/settings.json: that file is committed and shared with everyone who clones the project.

To try it in one terminal first, set the same values there instead. They last until you close the terminal:

export ANTHROPIC_BASE_URL="https://binference.io/api"
export ANTHROPIC_AUTH_TOKEN="binf_..."
export ANTHROPIC_API_KEY=""
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000
claude --model sonnet

Start Claude Code and check

Run claude in your project, then type /status. Three lines confirm the setup: Auth token names ANTHROPIC_AUTH_TOKEN, Anthropic base URL shows https://binference.io/api, and Model shows Sonnet.

What /status shows
claude

❯ /status

Status
cwd:
~/my-project
Auth token:
ANTHROPIC_AUTH_TOKEN
Anthropic base URL:
https://binference.io/api
Model:
sonnet (claude-sonnet-5-5)
Claude Code's Status tab with the settings from step 2. The three marked lines prove the setup: your key is the credential, calls go to the Router, and the session runs on Sonnet 5.5. Claude Code writes these lines in English.

Send any message. Its call shows on your Calls page within a minute, with what it cost.

If you also sign in to Claude Code with a Claude plan, the key takes over while it is set. Your sign-in stays saved: see Go back to your Claude plan.

Pick a model

Type /model to switch at any time, or start with claude --model <name>. The next section lists good picks.

Models to start with

Tested in Claude Code
Live price per 1M tokens: input / output
  • Claude Sonnet 5.5Default
    Everyday coding
  • Claude Opus 5.5
    Large codebases
  • Claude Fable 5.1
    The hardest tasks
  • Claude Haiku 4.5
    Quick, small edits
  • GPT-6.1 Sol
    Agentic coding
  • GPT-6 Astra
    OpenAI's flagship
  • Abliterated Large v2Uncensored
    What others refuse
Prices come live from the Router's model list, per million tokens read and written. Press a /model line to copy it, then paste it into Claude Code.

Every model was run through Claude Code on the Router before this page was written, each reading files and running commands with Claude Code's tools. Any other model on Models that handles tools well works the same way: use its id with /model.

Claude Code is built for Claude models. GPT and Abliteration models work through the Router, but Anthropic doesn't support them in Claude Code, so a feature may behave differently. On them, Claude Code prints that it doesn't know the model and keeps the session within 200,000 tokens before it compacts. That is expected.

More Claude models in the menu: add "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1" to env, and /model also lists every Claude model the Router serves, older versions included, by name.

What a turn holds

Before each call starts, the Router holds enough credit for the longest answer the call allows, plus the conversation so far. You pay only what the model writes, and the rest comes back when the call ends. See How a call is paid.

Claude Code asks for long answers: room for 128,000 tokens on Opus 5.5. At the start of a session, that holds about $2.40 per turn, and Claude Code's helpers running at the same time each hold their own. With the 32,000 cap from step 2, the same Opus turn holds about $0.67, and a Sonnet 5.5 turn about $0.33. Holds grow as the conversation grows, and pricier models like GPT-6 Astra hold several times more.

Does a turn fit your credit?
Your credit
  • Haiku 4.5$0.18
  • Abliterated Large v2$0.18
  • Sonnet 5.5$0.33
  • GPT-6.1 Sol$0.33
  • Opus 5.5$0.67
  • Fable 5.1$1.53
  • Opus 5.5No cap$2.36
  • GPT-6 Astra$9.09

5 of 8 fit in $13 models get 402

One Sonnet 5.5 turn: held and paid

First call$0.0534
writes the cache
Next call$0.0044
reads 26,463 tokens from it
Held per call
$0.33
First call
$0.0534
Next call
$0.0044
Measured on the Router on 7 October 2026: the first call of a new session, at listed prices, with the settings from step 2. Claude Opus 5.5 is also shown without the 32,000 cap, as Claude Code starts by default. Holds grow as the conversation grows.

When your credit can't cover a hold, Claude Code shows API Error: 402 and that the balance is below the request's reserve. Lower CLAUDE_CODE_MAX_OUTPUT_TOKENS, for example to 16000, pick a cheaper model, or add credit.

What you pay is a different story: Claude Code resends the whole conversation each turn, and the Router passes its cache marks through. In our test on Sonnet 5.5, the second call read 26,463 tokens from the cache and cost about a twelfth of the first.

Good to know

  • Long sessions: a request over 4 MB is refused with 413, usually because of pasted screenshots. Run /compact or /clear. To compact sooner, add "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "400000" to env.
  • /cost shows Anthropic's prices, not what you paid. Your real charges are on the Calls page.
  • /context counts are estimates: the Router doesn't count tokens ahead of a call, so Claude Code estimates them.
  • Auto mode may say the session "isn't eligible" for free safety checks. Press Enter: the checks run as ordinary calls on your key. To skip the notice, add "CLAUDE_CODE_AUTO_MODE_SERVER": "0" to env.
  • Remote Control and voice dictation need a Claude sign-in, so they're off while the key is set.
  • Claude desktop app: its Code tab keeps its own setting for the address and ignores this file. This page covers Claude Code in a terminal and in VS Code.
  • VS Code extension: put the same variables in VS Code's own settings, under claudeCode.environmentVariables, as { "name": "ANTHROPIC_BASE_URL", "value": "https://binference.io/api" } entries. The extension checks for a key there before it starts.
  • Let Claude Code watch its credit: connect the MCP server with the same key, and Claude Code can check its own balance, usage and limits.

Go back to your Claude plan

Delete the lines you added in step 2, or the whole env block, and start Claude Code again. Your Claude sign-in was kept: /status shows it as the login method again.

If something goes wrong

You seeFix
Claude Code asks you to sign inIt didn't read the key. Check the path and the JSON of ~/.claude/settings.json, or set the values in the same terminal
/status has no Anthropic base URL lineSame as above: the settings didn't reach Claude Code
401 and invalid_api_keyThe key is wrong or revoked. Make a new one on API keys
402 and "below this request's reserve"The credit can't cover the hold. See What a turn holds
402 and key_limitThe key reached its spending limit. It resets at 00:00 UTC, or raise it
413The conversation passed 4 MB. Run /compact

Every error code is on Errors, with what to do.

On this page