# Use Claude Code with OmniaKey

> Point Claude Code at OmniaKey's Anthropic-native endpoint — two environment variables, Claude models that are never silently swapped, billing per token with no monthly plan.

- Canonical HTML: https://omniakey.com/blog/claude-code-setup
- Markdown: https://omniakey.com/blog/claude-code-setup.md
- Published: 2026-05-14 (updated 2026-10-30)
- Author: Kiki, COO at OmniaKey
- Language: en
- Category: Guide
- Reading time: 4 min
- All posts: https://omniakey.com/blog/llms.txt

---

Updated October 30, 2026: three common setup errors now come with the symptom, the cause and the official fix, and every model named below links to its OmniaKey model page.

Claude Code speaks exactly one protocol: Anthropic's Messages API. That is by design, and it is why pointing it at OmniaKey takes two environment variables and changes nothing else — OmniaKey serves the same protocol natively. What you gain is one key and one balance shared across every tool you run, per-token billing with no monthly plan, and a guarantee that the model id you ask for is the one that runs.

## Setup

Create a key in the [dashboard](https://omniakey.com/dashboard/tokens), set two variables, and launch:

```bash
export ANTHROPIC_BASE_URL="https://api.omniakey.com"
export ANTHROPIC_AUTH_TOKEN="your-omniakey-api-key"
claude
```

Streaming, tool use, and long context all pass through unchanged — Claude Code still thinks it is talking to Anthropic directly.

> **Don't add `/v1` to the base URL.** Claude Code appends `/v1/messages` itself, so `https://api.omniakey.com/v1` turns into `/v1/v1/messages` and returns 404. Use the bare host.

### Common setup errors

#### Claude Code still bills my claude.ai plan

Symptom: usage limits and billing still follow your claude.ai subscription after you set the base URL.

Cause: `ANTHROPIC_BASE_URL` only changes where requests are sent. Anthropic's [gateway page](https://code.claude.com/docs/en/llm-gateway#subscriptions-and-gateways) says that setting it without a gateway credential leaves the saved claude.ai login as the active credential.

Fix: export the credential as well — the two exports above — and Claude Code sends the OmniaKey key instead, so the subscription's usage limits no longer apply.

#### `/model` shows one model and another one answers

Symptom: you switch with `/model`, but the session keeps running a different model.

Cause: an `ANTHROPIC_MODEL` exported in your shell overrides the `model` key in every settings file, and `--model` overrides both for that session, as [settings precedence](https://code.claude.com/docs/en/settings#a-flag-or-environment-variable-sets-the-same-thing) explains.

Fix: unset `ANTHROPIC_MODEL`, drop `--model` from the launch command, and pick the model with `/model`.

#### `model not found`, or a 200K warning on a 1M model

Symptom: the request fails with `model not found` or "you may not have access to it", or the session starts with a warning that the model isn't recognized and the context is assumed to be 200K tokens.

Cause: the id is not one the endpoint serves, or Claude Code does not recognize the id. Anthropic's [troubleshooting page](https://code.claude.com/docs/en/troubleshooting) points both messages to its error reference.

Fix: check the id against Anthropic's model list and pass the full id, as in `/model claude-sonnet-5`. For an id Claude Code cannot place, [model configuration](https://code.claude.com/docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id) gives the way out: `claude update`, a `modelOverrides` entry, or `CLAUDE_CODE_MAX_CONTEXT_TOKENS` set to the real window.

An old install can fail even before you pick a model. Started with no model set, Claude Code 2.0.76 asked for its built-in default model, which OmniaKey does not serve. Set one with `--model` or `ANTHROPIC_MODEL`, or update with the command for your install method in [Claude Code 2.0 and how to update](https://omniakey.com/blog/claude-code-2-0).

## Pick a model

Switch models inside the session with `/model`:

```text
/model claude-sonnet-5
```

Claude ids on OmniaKey include [Claude Fable 5](https://omniakey.com/claude-fable-5) (`claude-fable-5`, hardest long-running work, [1M context](https://code.claude.com/docs/en/model-config#extended-context)), [Claude Opus 5](https://omniakey.com/claude-opus-5) (`claude-opus-5`, complex work, 1M), [Claude Sonnet 5](https://omniakey.com/claude-sonnet-5) (`claude-sonnet-5`, daily balance, 1M), and [Claude Haiku 4.5](https://omniakey.com/claude-haiku-4-5) (`claude-haiku-4-5`, fast, 200K). The id you pass is the id that runs — OmniaKey never silently swaps, quantizes, or distills it. The [Claude Code model-selection guide](https://omniakey.com/blog/best-model-for-claude-code) maps each one to a task and subagent role.

## GPT and Gemini: a protocol boundary, not a limit

Claude Code drives Claude only. That is the Anthropic protocol talking, not OmniaKey — no gateway can make Claude Code run GPT, Gemini, or Grok without breaking the tool. To use those families in an agent, point an OpenAI-compatible tool (Cursor, Cline, aider, Codex, OpenClaw) at OmniaKey's OpenAI-compatible endpoint — the `/v1` one below — where only the model id changes: [GPT-5.5](https://omniakey.com/gpt-5-5) (`gpt-5.5`), [Gemini 3.1 Pro Preview](https://omniakey.com/gemini-3-1-pro-preview) (`gemini-3.1-pro-preview`), and [Grok 4.5](https://omniakey.com/grok-4-5) (`grok-4.5`) run exactly like a Claude id.

- **OpenAI-compatible**: <https://api.omniakey.com/v1>
- **Anthropic-native**: <https://api.omniakey.com>
- **Gemini-native**: <https://api.omniakey.com/v1beta>

OmniaKey exposes all three endpoints from one key. Coding tools use the OpenAI-compatible `/v1`; the Gemini-native `/v1beta` is there for Google's own Gemini SDK. The [coding agents guide](https://docs.omniakey.com/en/coding) has the per-tool setup.

## Why predictability matters in an agent

A gateway that silently reroutes to a "cheaper equivalent" under load is especially dangerous in a coding agent: a different model formats tool calls differently and reasons about your codebase differently, so a mid-task swap can corrupt a multi-file edit. With OmniaKey, if an upstream is unavailable you get the error and pick another model yourself — never a substitution behind your back.

Still deciding which agent should own that workflow? Read the [Claude Code vs Codex comparison](https://omniakey.com/blog/claude-code-vs-codex) before configuring either tool.

If the billing question comes first, the [Claude Code API without a subscription guide](https://omniakey.com/blog/claude-code-api-without-subscription) separates subscription OAuth from legitimate pay-as-you-go API access and explains which credential actually pays for a request. Setting up a different agent instead? The same key works in Hermes Agent, OpenClaw and Cline; follow the [Hermes Agent setup](https://omniakey.com/blog/hermes-setup), [OpenClaw setup](https://omniakey.com/blog/openclaw-setup) or [Cline custom API key](https://omniakey.com/blog/cline-custom-api-key) guide. For a desktop client, see the [Cherry Studio API setup](https://omniakey.com/blog/cherry-studio-api-setup) and [WorkBuddy custom model setup](https://omniakey.com/blog/workbuddy-custom-model-setup).

## Frequently asked questions

### How do I point Claude Code at OmniaKey?

Set two environment variables before you launch: `ANTHROPIC_BASE_URL` with `https://api.omniakey.com` and `ANTHROPIC_AUTH_TOKEN` with your OmniaKey key. Then run `claude`.

### Why does Claude Code return a 404?

The base URL probably ends in `/v1`. Claude Code appends `/v1/messages` itself, so `https://api.omniakey.com/v1` becomes `/v1/v1/messages` and returns 404. Use the bare host.

### Can Claude Code run GPT, Gemini, or Grok through OmniaKey?

Claude Code drives Claude only, because the Anthropic protocol is what it speaks. For those families, point an OpenAI-compatible tool at the `/v1` endpoint and change only the model id.

### Which Claude model should I use in Claude Code?

`claude-sonnet-5` for daily work, `claude-opus-5` for complex work, and `claude-fable-5` for the hardest long-running tasks. `claude-haiku-4-5` is the fast one for small edits.

### Does OmniaKey swap the model I ask for?

No. The id you pass is the id that runs — OmniaKey never silently swaps, quantizes, or distills it. If an upstream is unavailable you get the error and pick another model yourself.

## Sources checked

- [Anthropic: Other LLM gateways](https://code.claude.com/docs/en/llm-gateway)
- [Anthropic: Settings files and precedence](https://code.claude.com/docs/en/settings)
- [Anthropic: Model configuration](https://code.claude.com/docs/en/model-config)
- [Anthropic: Troubleshooting](https://code.claude.com/docs/en/troubleshooting)
