Skip to content
TOOLING

Claude Code in 2026: Setup with Claudexia and Pay-as-You-Go

Anthropic's Claude Code CLI is the best AI pair programmer. Here is how to point it at Claudexia for transparent pay-as-you-go billing — env vars, settings.json, Windows, GUI.

If you write code for a living in 2026, you have almost certainly tried Anthropic's Claude Code — the official CLI that turns Claude into a genuine pair programmer that lives in your terminal, reads your repo, runs your tests, and edits your files. After two years of iteration it has become the default agentic coding tool for a large slice of the industry, eclipsing the IDE-bound assistants of the early 2020s.

The one rough edge is billing. Anthropic's direct API requires a US or EU corporate card, monthly invoicing, and a Console account that is awkward to share across a team or to set up from a country where the card form just refuses to submit. Claudexia exists to remove that friction: same Claude models, same Anthropic-compatible endpoint, but pay-as-you-go top-ups via crypto, card, or SBP. Five-minute setup, no contract, no monthly minimum.

This guide walks through the setup end to end on macOS, Linux, and Windows, plus the GUI installer, the settings.json approach for persistent configuration, model selection, spend tracking, and the short list of errors you might hit on the first run.

Why route Claude Code through Claudexia

Three reasons, in order of how often customers cite them:

  1. No Anthropic billing account required. You do not need a US corporate card or a Console subscription. Top up Claudexia with the payment rail that actually works in your country and start using Claude Code the same minute.
  2. Transparent per-token pricing. Claudexia matches Anthropic's per-model rates one-for-one. You pay for the tokens you used, the dashboard shows every request with its input/output/cache breakdown, and there is nothing else on the invoice.
  3. One key for the whole stack. The same cx_... key works with Claude Code, the Anthropic Python and TypeScript SDKs, the Claude Agent SDK, and any OpenAI-compatible client that speaks the /v1/messages or /v1/chat/completions shape. One top-up, one spend log, every tool.

If you already have an Anthropic account and are happy with it, keep using it. Claudexia is for the developers and teams who want Claude Code without the procurement detour.

Step 1 — Install Claude Code

Claude Code ships as a standalone binary plus an npm package. Pick whichever fits your workflow.

npm (works everywhere Node ≥ 18 is installed):

npm install -g @anthropic-ai/claude-code

macOS / Linux installer (no Node required):

curl -fsSL https://claude.ai/install.sh | sh

Windows GUI installer: download claude-code-setup.exe from the official Claude Code page and run it. The installer adds claude to your PATH and registers a Start menu entry.

Verify the install:

claude --version

You should see something like claude-code 2.x.x. If the command is not found, restart your shell so the new PATH is picked up.

Step 2 — Point Claude Code at Claudexia

Claude Code reads two environment variables to decide where to send requests:

  • ANTHROPIC_BASE_URL — the API host. Default is Anthropic's production endpoint. Set it to https://api.claudexia.tech to route through Claudexia.
  • ANTHROPIC_API_KEY — your key. Replace any Anthropic sk-ant-... value with the Claudexia cx_... key from your dashboard.

macOS / Linux (zsh or bash):

export ANTHROPIC_BASE_URL="https://api.claudexia.tech"
export ANTHROPIC_API_KEY="cx_live_yourkeyhere"

Add those two lines to ~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish to make them persistent.

Windows PowerShell (current session):

$env:ANTHROPIC_BASE_URL = "https://api.claudexia.tech"
$env:ANTHROPIC_API_KEY  = "cx_live_yourkeyhere"

Windows PowerShell (persistent, across reboots):

setx ANTHROPIC_BASE_URL "https://api.claudexia.tech"
setx ANTHROPIC_API_KEY  "cx_live_yourkeyhere"

setx writes to the user environment, so close and reopen the terminal for the new values to take effect. If you prefer a GUI: open System Properties → Advanced → Environment Variables and add the two entries under User variables. The GUI route is what most non-developer teammates use and it works identically.

Step 3 — Verify the connection

Open a fresh terminal so the new env vars are loaded, then:

claude --version
claude /status

claude /status makes a real round-trip against the configured base URL and prints the active model, account, and key prefix. If you see api.claudexia.tech in the output and a non-zero balance, you are done.

Try a one-shot prompt to confirm end-to-end:

claude -p "Summarise the diff in this repo since main."

The settings.json approach (recommended for teams)

Environment variables are great for one developer on one machine. For teams, or for any machine where you want the configuration to survive shell changes, use Claude Code's settings.json. It lives at ~/.claude/settings.json on macOS and Linux, and at %USERPROFILE%\.claude\settings.json on Windows.

{
  "apiBaseUrl": "https://api.claudexia.tech",
  "apiKey": "cx_live_yourkeyhere",
  "defaultModel": "claude-sonnet-4.6",
  "telemetry": false
}

The CLI reads settings.json on every invocation, so you can change the model or rotate the key without touching your shell profile. For shared workstations, set the file permissions to 600 so other users on the box cannot read your key.

Picking a model

Claude Code defaults to Sonnet 4.6, which is the right answer for roughly 90% of tasks: refactors, test generation, code review, multi-file edits, debugging. It is fast enough to feel interactive and cheap enough that you will not flinch at long sessions.

For genuinely hard problems — architectural design, gnarly bug hunts across a large codebase, or anything where one Opus call replaces five Sonnet retries — switch to Opus on demand:

claude --model claude-opus-4.7 -p "Design a sharding strategy for this table."

For high-throughput, low-stakes work (lint fixes, doc rewrites, commit message generation) drop to Haiku:

claude --model claude-haiku-4.6 -p "Rewrite this commit message."

The model picker also works inside an interactive session: type /model and pick from the list.

Tracking spend

Every request that hits api.claudexia.tech shows up in the Claudexia dashboard within a few seconds, broken down by:

  • timestamp and request ID,
  • model used,
  • input tokens, output tokens, and cached input tokens,
  • exact dollar cost for that call,
  • the API key that made the call (handy when you give different keys to different machines or teammates).

You can filter by date range, by model, or by key, and export the ledger as CSV for accounting. There is no monthly bill, no minimum, and no surprise charge — when your balance hits zero, the next request returns a 402 and you top up.

Troubleshooting

A short list of the errors you are most likely to see on day one:

  • 401 Unauthorized — wrong or expired key. Confirm ANTHROPIC_API_KEY starts with cx_ and matches the value in your dashboard. If you rotated the key recently, the old one is dead.
  • 429 Too Many Requests — you hit a per-minute rate limit. Wait a few seconds and retry. Heavy parallel agents should respect the Retry-After header.
  • 402 Payment Required — balance exhausted. Top up from the dashboard.
  • 502 Bad Gateway / network timeouts — transient upstream issue. Check the status page at status.claudexia.tech before debugging your own code.
  • claude command not found after install — restart your shell so the new PATH is picked up, or, on Windows, log out and back in after the GUI installer completes.

Bottom line

Five minutes from npm install to your first claude /status against Claudexia. Two environment variables, or one settings.json, and the best AI pair programmer of 2026 is wired to a billing model that actually works for you.

For the longer reference — every flag, every config field, every supported model — see /docs/guides/claude-code.