inert
Sign up

Use Claude Code with any Anthropic-compatible API

Claude Code is a native Anthropic client, and it does not pin itself to one vendor address. It reads a base URL and a credential out of the environment, then speaks the Anthropic Messages API to whatever answers on the other end. That single detail is why you can move it onto a compatible gateway in about a minute without touching your projects, your prompts, or your habits.

This guide points Claude Code at inert, a gateway that speaks the Anthropic Messages API (/v1/messages) and the OpenAI Chat Completions API (/v1/chat/completions) from one address. The same steps work for any endpoint that is faithful to the Anthropic API.

Why Claude Code moves so easily

Most harnesses need a provider adapter: a config block that names the vendor, a model list to keep in sync, sometimes a plugin. Claude Code needs none of that. It needs two environment variables, because the API it already speaks is the API a compatible gateway answers.

Nothing about the shape of the request changes, so the parts of Claude Code that ride on that shape keep working the way they always did. You are swapping the address on the envelope, not rewriting the letter.

What you need before you start

  1. Claude Code installed and working.
  2. An inert account and an API key. The key is shown once and stored only as a digest, so save it somewhere safe the moment you create it.
  3. Balance on the account. Requests draw from that balance instead of a per-seat subscription, which is the whole point: one key for the harness, no plan to spread across a team.

If you have not created a key yet, the quickstart covers account, key, and first request in a few lines.

Set the two environment variables

The base URL is the bare host. Do not append /v1, because Claude Code appends /v1/messages itself:

bash
export ANTHROPIC_BASE_URL=https://api.inert.lol
export ANTHROPIC_AUTH_TOKEN=<inert key>

Either credential variable works, and they behave slightly differently:

  • ANTHROPIC_AUTH_TOKEN is sent as an Authorization: Bearer header. This is the one to reach for first, because it takes precedence over an existing claude.ai login straight away.
  • ANTHROPIC_API_KEY is sent as an x-api-key header. If a claude.ai login already exists on the machine, this route needs a one-time approval through /config before it takes effect.

Open a new Claude Code session after exporting. A running session keeps the environment it was launched with.

Persist the settings per project

A shell export dies with the shell. For work you come back to, write the same two values into .claude/settings.local.json at the root of the project, which is gitignored, so the key never reaches a commit:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.inert.lol",
    "ANTHROPIC_AUTH_TOKEN": "<inert key>"
  }
}

Per project is usually what you want, since it lets one repository bill to a client account while another stays on your own. To route everything the same way, put the identical env block in ~/.claude/settings.json instead.

VS Code extension

The Claude Code extension for VS Code does not read .claude/settings.local.json. Set the same two variables in the claudeCode.environmentVariables setting, or the extension will quietly keep using whatever credential it had before.

Verify the connection

Run /status inside Claude Code. It reports which credential source is active, which is the fastest way to catch the usual failure: the variables were exported in one terminal and Claude Code was launched from another. If /status still names a claude.ai login, the token never reached the process.

The full setup reference, including every place these variables can live, is the Claude Code guide in the docs.

Pick the route that fits the work

Model identifiers on inert are route names in kebab case, fable-5 and opus-5, and GET /v1/models is always the live list:

bash
curl https://api.inert.lol/v1/models \
  -H "x-api-key: <key>"

Fable is the route for ambitious coding and dependable multi-step agent work. Opus is the route for planning, architecture, and technical thinking that rewards care. What each route is good at, side by side, is on the routes table.

What stays the same, and what does not

What stays the same is the interesting part. Claude Code behaves like Claude Code: the terminal workflow, the project context, the commands you have muscle memory for. A gateway that is faithful to the Anthropic API has no room to be creative about the request path, and inert is built against real Claude Code sessions for exactly that reason.

What changes is the account model underneath. Completions come from a pool of Anthropic accounts rather than a subscription you buy, renew, and divide between people. Your harness holds one key, and every request draws on your balance.

Privacy changes shape too, in your favour. Prompt and completion content is never written to Postgres, to Valkey, or to application logs. Sessions and rate limit counters expire by design, no IP addresses or user agents are retained, and an API key exists in storage only as a digest plus a short identifier.

Next steps

  • Claude Code guide: the complete setup reference, start to finish.
  • Quickstart: create a key and make your first request.
  • Routes: what each route is best at before you pick one.