Sign inSign up
DocsClaude Code

Claude Code

Use Claude Code with open models through Tokener CA's Anthropic-compatible (Messages) API — set the base URL, the API key as the auth token, and the models by environment variable.

Updated:

Does Claude Code work with Tokener?

Yes. Claude Code talks to Tokener CA over the Anthropic-compatible (Messages) endpoint, so it runs against Tokener's open models once you point it at Tokener's base URL and give it your API key. You need two things: a Tokener API key (starts with tok-) and Claude Code installed on your machine.

Before you start: an honest note

Claude Code's vendor does not support using it with models other than its own. This guide is a configuration that works today through Tokener's Messages-compatible API — it is not endorsed by the tool's vendor. Open models also behave differently as coding agents than the vendor's own models: in our end-to-end testing an open model completed short edits and a small multi-step task (write a file, run it, report the result) reliably, but it can spend a few extra turns on a trivial prompt. Treat it as a capable, cheaper coding agent, not a drop-in replacement.

Set it up

Claude Code reads its connection from environment variables. Set the base URL to https://a.tokener.ca — no /v1 (the tool appends the path itself). Put your API key in ANTHROPIC_AUTH_TOKEN, and set the main and background models explicitly, because the tool cannot discover Tokener's models on its own.

Shell environment

Bash
export ANTHROPIC_BASE_URL=https://a.tokener.caexport ANTHROPIC_AUTH_TOKEN=$TOKENER_API_KEY          # your Tokener API keyexport ANTHROPIC_MODEL=glm-5.3:flash                  # the main modelexport ANTHROPIC_DEFAULT_HAIKU_MODEL=<a cheaper model id>   # background/small callsexport ANTHROPIC_SMALL_FAST_MODEL=<the same cheaper model id>unset ANTHROPIC_API_KEYclaude

Pick the cheaper background model from /models; do not use the login flow's own model names. Leave ANTHROPIC_API_KEY unset so the tool cannot fall back to another credential — ANTHROPIC_AUTH_TOKEN is your Tokener key.

~/.claude/settings.json (your private user file) — the same settings in the "env" block:

JSON
{  "env": {    "ANTHROPIC_BASE_URL": "https://a.tokener.ca",    "ANTHROPIC_AUTH_TOKEN": "your Tokener API key",    "ANTHROPIC_MODEL": "glm-5.3:flash",    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "a cheaper model id from /models",    "ANTHROPIC_SMALL_FAST_MODEL": "a cheaper model id from /models"  }}

No other switches are needed — Tokener accepts Claude Code's requests as they are sent.

First run and how to check it

Start claude in a project directory and ask it something small, for example "reply with the single word: ok", then a real edit like "create a file hello.txt containing hi". To confirm it is talking to Tokener, open the Usage page: the requests appear with Protocol = Anthropic-compatible (Messages).

What it costs

Every agent turn sends a large prompt (the tool's system prompt plus your files), so most of the cost is input tokens. Input is billed at the model's input rate, and the cached part at its cache-read rate where the model has one — see How the numbers are counted and billed. Prices per model are on /models.

What is different

  • Token counting is optional — Claude Code works without it. POST https://a.tokener.ca/v1/messages/count_tokens is free, but it is available only on accounts that have turned on Also allow suppliers without that commitment under Account settings → Data handling; otherwise it answers 404 "Token counting is not available on this API." See the Anthropic SDK guide.
  • No JSON-output mode on this protocol.
  • No vendor-hosted tools — features like the vendor's web search are not offered; local tools (file edits, running commands) work as usual.
  • No model discovery — the tool's model picker will not list Tokener's models. Set them with the environment variables above.

Troubleshooting

SymptomCheck first
A login / sign-in prompt appearsANTHROPIC_AUTH_TOKEN is set to your key, and ANTHROPIC_API_KEY is unset
401The API key is correct and current — create one on the API keys page
402Your balance is used up — add funds (see Pricing)
404 on every callThe base URL has a doubled /v1 — use https://a.tokener.ca, with no /v1
404 on a modelANTHROPIC_MODEL (or the background model) is a current id from /models
An occasional 400 ("check your parameters") on a single turnA transient hiccup, not your setup — run it again; if it persists, contact support
  • Anthropic SDK — call the Anthropic-compatible (Messages) endpoint from your own code.
  • Developer Onboarding — keys, protocols and your first request.
  • Models — the models you can set, with prices.