Switch from OpenAI or Anthropic
Code written for the OpenAI Chat Completions API or the Anthropic Messages API runs on Claudech after three changes: the base URL, the API key and the model id. Request and response shapes stay the same, so the rest of your code does not change.
Before you start#
- A Claudech API key from API keys. API access unlocks after your first purchase.
- Store it as an environment variable, for example
CLAUDECH_API_KEY, rather than in code.
From the OpenAI API#
| Setting | Before | After |
|---|---|---|
| Base URL | https://api.openai.com/v1 | https://api.claudech.com/v1 |
| API key | Your OpenAI key | Your Claudech sk-... key |
| Model | An OpenAI model name | A Claudech model id, e.g. claude-opus-5-5 |
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["CLAUDECH_API_KEY"],
base_url="https://api.claudech.com/v1",
)
res = client.chat.completions.create(
model="claude-opus-5-5",
messages=[{"role": "user", "content": "Hello"}],
)Many tools read the standard environment variables, so you can often switch without touching code:
export OPENAI_BASE_URL=https://api.claudech.com/v1
export OPENAI_API_KEY=sk-...What works the same#
Streaming, tool calling, JSON mode, image input, system and developer messages, max_completion_tokens and reasoning_effort all behave as in the OpenAI API. See Streaming and Tool calling & JSON.
What is different#
| Area | Claudech behaviour |
|---|---|
| Endpoints | Only /v1/chat/completions and /v1/models follow the OpenAI shape. The Responses API, embeddings, images, audio and files are not offered. |
n | Only 1 is supported. |
response_format.json_schema | Treated as json_object; validate the output yourself. |
logprobs | Accepted; always returns null. |
| Unknown parameters | Ignored rather than rejected. |
usage | Adds claud_tokens_debited and claud_cost_usd with the exact charge. |
If your app also uses embeddings, keep them on your current provider and move only the chat calls.
From the Anthropic API#
| Setting | Before | After |
|---|---|---|
| Base URL | https://api.anthropic.com | https://api.claudech.com (no /v1) |
| API key | Your Anthropic key | Your Claudech sk-... key, sent as x-api-key |
| Model | An Anthropic model name | A Claudech model id, e.g. claude-opus-5-5 |
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["CLAUDECH_API_KEY"],
base_url="https://api.claudech.com",
)
msg = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)Tool use, system prompts, image blocks, stop_sequences, streaming events and thinking blocks are supported. See Messages (Anthropic format). For Claude Code, follow Claude Code setup.
Choose a model#
Every Claudech model has a 1M-token context window, supports tool calling and image input, and costs the same per token. Pick by task rather than price:
claude-opus-5-5for most work.claude-fable-5-1orclaude-opus-5for long outputs and hard reasoning.claude-sonnet-5for fast, simple tasks such as titles, classification and autocomplete.
The full list with output limits is on Models.
Check the switch#
- Send one request and confirm the
x-claud-modelresponse header names the model you asked for. - Compare the
usagefields with the request on your Usage page. - Run your existing tests. If something fails, the Errors page lists every error code.
Things to know#
- Rate limits depend on your plan. See Rate limits before moving high-volume traffic.
- Billing is per token from a prepaid balance. See Tokens & billing.
- Fallbacks. If a model is temporarily unavailable, Claudech can serve the request from a fallback model of equal or greater capability and says so in the response. See Fallbacks.
Claudech is an independent service and is not affiliated with OpenAI or Anthropic. It implements their public request formats so existing code keeps working.