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#

SettingBeforeAfter
Base URLhttps://api.openai.com/v1https://api.claudech.com/v1
API keyYour OpenAI keyYour Claudech sk-... key
ModelAn OpenAI model nameA 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:

Shell
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#

AreaClaudech behaviour
EndpointsOnly /v1/chat/completions and /v1/models follow the OpenAI shape. The Responses API, embeddings, images, audio and files are not offered.
nOnly 1 is supported.
response_format.json_schemaTreated as json_object; validate the output yourself.
logprobsAccepted; always returns null.
Unknown parametersIgnored rather than rejected.
usageAdds 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#

SettingBeforeAfter
Base URLhttps://api.anthropic.comhttps://api.claudech.com (no /v1)
API keyYour Anthropic keyYour Claudech sk-... key, sent as x-api-key
ModelAn Anthropic model nameA 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-5 for most work.
  • claude-fable-5-1 or claude-opus-5 for long outputs and hard reasoning.
  • claude-sonnet-5 for fast, simple tasks such as titles, classification and autocomplete.

The full list with output limits is on Models.

Check the switch#

  1. Send one request and confirm the x-claud-model response header names the model you asked for.
  2. Compare the usage fields with the request on your Usage page.
  3. 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.