Skip to navigation

Anthropic API Alternatives: Same SDK, Different Base URL

In short: Anthropic API alternatives that keep the Anthropic SDK: a dated table of nine routes, what each ignores, an 8-check probe script and a bill calculator.

Published 27 min read
On this page

If your code calls the Anthropic SDK and you want a way out of one vendor, one price or one outage, the usual advice is a list of logos. This post is built differently: Anthropic API alternatives from nine routes, each read from its own documentation on 28 November 2026, with the base URL, the credential, and what that route says it ignores or does not offer. You also get an 8-check Python probe you can point at any Messages endpoint without naming a Claude model, and a bill calculator that puts rate, fee and tokenizer in one number. We publish this post, and One AI API Key is one of the nine rows, so we mark where rivals are stronger and where we cannot help you today.

What does “Anthropic API alternative” actually mean?

Three different questions hide behind the phrase, and the answers are different for each.

Same models, different door. You want Claude itself but through another account: a cloud platform for billing and compliance, or a gateway that forwards to Anthropic. Anthropic’s API overview lists Amazon Bedrock, Google Cloud, Microsoft Foundry and Claude Platform on AWS as ways to reach Claude, and says feature availability varies by platform. The code change is small, the model is the same, and the question is who invoices you and which features arrive late.

Same format, different models. You keep the Anthropic SDK and the Messages request shape, and the endpoint answers with another vendor’s model. DeepSeek and Z.ai both publish Anthropic-format base URLs for this. Here the code change is small but the behaviour change is large: prompts that were tuned for one model family meet another one. Our post on cost per successful task for Claude Opus 5.5 alternatives is the place to test that part.

Different format. You give up the Anthropic SDK and move to the OpenAI chat format, which nearly every provider accepts. That is a larger edit, and the OpenAI versus Anthropic format guide lists every difference. Anthropic itself ships an OpenAI SDK compatibility layer in the other direction, and its page calls it a way to test and compare Claude, not a long-term or production-ready solution for most use cases.

This post covers the first two. The third is the subject of the OpenAI API alternatives guide and the Gemini API alternatives guide. The diagram shows where the swap sits, and why the last box is the risky one.

What a base URL swap touches

Your Anthropic SDK callmodel, max_tokens, messages, toolsBase URL and key: the swapANTHROPIC_BASE_URL, x-api-keyEndpoint that speaks Messagesheaders and features it supportsThe model that answersClaude, or a mapped other modelReply, usage and billtokens counted by that route
Only the second box is a one-line change. The third and fourth decide whether your code still behaves: what the endpoint accepts, and which model really answers.

Which routes speak the Messages format?

Nine, as of the day we read each page. The table lists the base URL as the vendor prints it, how you authenticate, and the one fact from each page that most affects a swap. Every cell comes from the page in the last column, read on 28 November 2026, except the last row, which comes from our own docs and the public models list.

Route Base URL as documented Credential What the page says that matters Source
Anthropic API https://api.anthropic.com Authorization: Bearer or x-api-key, plus anthropic-version Messages, Batches (50 percent cost reduction), Token Counting, Models, Files and Skills APIs Overview
Cloud platforms Their own endpoints; Claude Code uses variables such as ANTHROPIC_BEDROCK_BASE_URL Cloud IAM The cloud provider invoices you; feature timing varies; Bedrock caps requests at 20 MB against 128 MB first-party Overview, Claude Code protocol guide
Vercel AI Gateway https://ai-gateway.vercel.sh x-api-key or Bearer; Bearer wins if both are sent Messages, count_tokens and the batch endpoints Vercel docs
OpenRouter https://openrouter.ai/api ANTHROPIC_AUTH_TOKEN; ANTHROPIC_API_KEY must be set to an empty string 5.5 percent fee on credit purchases, $0.80 minimum Agent SDK page, FAQ
Cloudflare AI Gateway https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/anthropic Provider key in x-api-key plus a separate cf-aig-authorization header, or stored keys Bearer is not read as the provider credential on this endpoint Cloudflare docs
LiteLLM proxy (self-hosted) Your own host Set by the operator Calls other vendors’ models in the /v1/messages format; lists cost tracking, fallbacks and load balancing LiteLLM docs
DeepSeek https://api.deepseek.com/anthropic x-api-key or Bearer anthropic-version ignored; cache_control ignored; Claude model names mapped to DeepSeek models DeepSeek guide
Z.ai https://api.z.ai/api/anthropic ANTHROPIC_AUTH_TOKEN Model names set through ANTHROPIC_DEFAULT_*_MODEL variables Z.ai docs
One AI API Key {ANTHROPIC_BASE} (no /v1) x-api-key or Bearer Messages route documented for Claude ids; Batches and Files not offered; count_tokens is an estimate Messages reference, models list

Three patterns stand out. First, authentication is not uniform: an SDK that sends x-api-key works as is on several of these, while Cloudflare wants a second header and OpenRouter wants an empty ANTHROPIC_API_KEY for Claude Code. Second, the feature surface differs: of the pages we read, only the first-party API and Vercel list batch endpoints, and ours says plainly that it offers none. Third, the two vendor-run endpoints (DeepSeek and Z.ai) put another model behind the Anthropic shape, and each says how names are mapped. A route that maps names openly is a different thing from a service that swaps models without saying so, though both look the same from the SDK. The shadow API study explainer covers the second kind.

For deeper comparisons of the gateway rows, see the LiteLLM alternatives post, the Cloudflare AI Gateway guide, the Vercel AI Gateway guide, the Portkey guide and the broader nine-gateway comparison. We keep this post to what changes when the SDK stays the same.

What does the swap not change?

Your request keeps its shape. Almost everything around it can differ. Here are the four places we would look first, in the order they tend to bite.

Which headers does the route want?

Anthropic’s overview now lists Authorization: Bearer as the primary credential and x-api-key as a legacy fallback that is still supported. The SDKs send what they send, and the routes above cope in different ways. Vercel says that if you send both headers it uses the Bearer token and ignores the other. Cloudflare says Bearer is not read as the provider credential on its Anthropic endpoint. For Claude Code, Anthropic’s connect page maps ANTHROPIC_AUTH_TOKEN to a Bearer header and ANTHROPIC_API_KEY to x-api-key, and tells you to try the token variable first if your gateway team did not say. Our authentication reference accepts either header on the Messages endpoint, so one HTTP client can serve both formats.

Which API version do you send?

This one surprised us. Anthropic’s versioning page, read on 28 November 2026, shows anthropic-version: 2026-10-21 as its example and recommends the latest version. For that version it says the temperature, top_p and top_k request parameters are removed, and that a request sending any of them gets a 400 on every model. The older 2023-06-01 is still in Anthropic’s version history, and our docs say the gateway sends it when you omit the header.

So the same request body can be valid on one route and a 400 on another. DeepSeek documents temperature as a supported field (range 0.0 to 2.0, taking effect in non-thinking mode) and says it ignores anthropic-version and top_k altogether. A codebase that sets temperature=0.2 everywhere will behave on DeepSeek’s endpoint and break the day you pin the newest Anthropic version. We have not tested what each route does with a 2026-10-21 header value; the last line of the probe below prints it for you, because that is faster than reading eight changelogs.

What does the route do with a model name it does not know?

This is where the “same SDK” promise needs the most care. DeepSeek’s page says model names that start with claude are accepted even when unsupported: claude-opus* names are mapped to deepseek-v4-pro and other claude* names to deepseek-flash, while unsupported names that do not start with claude return a 400. It also notes that the claude-opus mapping is billed at the V4 Pro price. That is documented, honest and useful: an app hard-coded to a Claude name still runs. It also means your logs say one model while another answered, and your bill follows the mapped model.

The defence is cheap. Read the model field in the reply, and treat a mismatch with the id you sent as a finding. That is the second check in the probe, and it is the same instinct as the six free checks for a real model. The academic audit “Real Money, Fake Models” looked at three shadow API services and reported identity verification failures in 45.83 percent of fingerprint tests, so the check is not paranoia.

Which fields and features are ignored?

DeepSeek’s page is the clearest example because it lists support field by field. Fully supported: x-api-key, stream, system, stop_sequences. Ignored: cache_control on text and tool blocks, top_k, mcp_servers, container, service_tier, the budget_tokens value inside thinking, and anthropic-beta for the Messages endpoint with one exception for file images. Not supported: redacted_thinking blocks and search_result blocks.

Read that list against your own code. If you rely on cache_control breakpoints to cut your input bill, a route that ignores them silently turns a cached rate into a full rate, which is the kind of line item the token billing audit is for. Our own prompt caching page says what we bill and how to check hits, and ours forwards native Messages requests with the breakpoints you sent.

Does your agent behave the same behind a different route?

For a coding agent the question is sharper, because the client does more than send one request. Anthropic’s gateway compatibility guide is written for gateway operators and is worth reading as a buyer. It says a gateway must expose the Messages endpoints, forward the anthropic-beta and anthropic-version headers unchanged, and relay the stream event by event. If a gateway buffers the response, Claude Code stalls; if a body ends before the final message_delta, the client treats it as a dropped connection; and if the gateway strips the keep-alive ping events during a long thinking pause, the client’s idle timeout can fire. Token-counting endpoints are the only optional ones: without them Claude Code falls back to a character-based estimate.

Two other lines matter. The gateway overview page says Anthropic does not endorse, maintain or audit third-party gateways, and does not support routing Claude Code to non-Claude models through any gateway. The vendors above publish such setups anyway, and they may work well, but you are in community territory. And a gateway that exposes one Anthropic-format endpoint regardless of upstream is what makes provider switching painless; one that exposes a provider’s own format ties the client to that provider.

If you are choosing a route for an agent rather than an SDK script, the guide on what changes when Claude Code uses a custom base URL covers the billing and login side, the post on owning the model layer instead of renting one stack covers the design side, and the coding agent key guide lists the settings for the common clients.

What do the rates look like next to each other?

Price is not quality, but it sets the stakes of the whole exercise. The chart uses output rates per million tokens from the Anthropic pricing page and the DeepSeek pricing page, both read on 28 November 2026. DeepSeek publishes peak and off-peak rates; both are shown. Anthropic’s Haiku 5.5 rate applies to prompts up to 100,000 tokens.

Output price per 1M tokens, vendor pages, 28 November 2026

  • Claude Haiku 5.5 (Anthropic)$0.50prompts up to 100,000 tokens
  • deepseek-flash, off-peak$0.60
  • deepseek-flash, peak$1.20
  • deepseek-v4-pro, off-peak$1.98
  • deepseek-v4-pro, peak$3.96
  • Claude Sonnet 5.5 (Anthropic)$10
  • Claude Opus 5.5 (Anthropic)$20
Rates are list prices from each vendor's own page. They say nothing about whether a model finishes your task: divide by your success rate before you compare, as the cost-per-successful-task post explains.

Two more numbers belong in any switch. Anthropic’s pricing page says its 4.7-and-later tokenizer produces roughly 30 percent more tokens for the same text than older ones, so a move between Claude generations changes volume as well as rate. And OpenRouter’s FAQ states a 5.5 percent fee, $0.80 minimum, when you buy credits, while passing model prices through without markup. Neither shows up in the per-million chart. The calculator does include them.

Monthly bill: your current route against another

Route A monthly bill
$160.00
Route B monthly bill
$21.60
Difference per month
$138.40
Times route B can rerun a task before it costs more
7.41

Defaults are an example, not a quote: route A at a $2 and $10 list rate, route B at deepseek-flash peak rates from 28 November 2026. Enter your own rates. Cached input is not modelled.

With the defaults, route A costs 40 × $2 + 8 × $10 = $160 a month and route B costs 40 × $0.30 + 8 × $1.20 = $21.60, so the gap is $138.40 and route B could rerun every task about 7.4 times before it cost more. That last number is the useful one. A cheaper model that fails a third of your tasks and needs a retry is still far ahead at these rates, and one that fails nine in ten is not. The cost-per-task method and the site cost calculator turn that into your own figures, and the post on cutting API costs covers caching and trimming.

Where does One AI API Key fit, and where does it not?

We publish this post, so read this section with that in mind. Here is what is true on 28 November 2026.

What we have. One key that works in both the OpenAI format and the Anthropic Messages format. The Messages route is documented at /docs/anthropic-messages: the base URL has no /v1, either header is accepted, anthropic-version defaults to 2023-06-01 if you leave it out, and max_tokens defaults to 8,192 if you do. It lists tools, images and PDFs, streaming, prompt caching and extended thinking as forwarded, and answers count_tokens locally with an estimate flagged by an X-Count-Method: estimate header. Keys can carry a spend limit, an expiry and a model list (authentication docs), and up to three fallback ids can ride in an X-Fallback-Models header (routing docs). Sign-in is Google only, there is no card field, and new accounts get $10 of credit for priced models.

What we do not have. The Message Batches and Files APIs are not offered, which matters if you rely on Anthropic’s 50 percent batch discount. And the part you may have come for: the public models list shows 4 ids that carry the Anthropic protocol, and every one of them is marked unavailable today. Our docs say the Messages format is for Claude models, so the endpoint exists and is documented, but there is nothing on it to call right now, and the free ids are served in the OpenAI format only. If you need Claude in the Messages format today, the first-party API, a cloud platform or another gateway in the table is the honest answer.

What you can do today. Priced access is set up by hand, offline, to stop abuse and card fraud: email somdutt777@gmail.com and ask what is open before you plan around any priced id. The reasoning is in the post on why paid access goes through email, including what it costs you in speed. For free, the OpenAI-format lane works straight after a Google sign-in: 48 ids share 100 requests and 3,000,000 tokens a day, and they keep working at a $0 balance. That is enough to test whether your prompts survive a move to a different model family, which is the riskiest part of any swap.

Where rivals are stronger. Vercel documents batch endpoints and a Messages route you can use today with Claude. OpenRouter has the broader catalogue and a documented Claude Code setup, and its fee is stated plainly. Cloud platforms win on compliance and invoicing. LiteLLM wins on control, if you will operate it. DeepSeek and Z.ai run their own models on their own endpoints, with no reseller in the middle. Our edge is narrower: a free lane with the cap printed, a transparency page that says what we monitor, a status page, published usage rankings, and per-key limits. The comparison with OpenRouter, the Portkey comparison and the post on the unified key trade-offs set out the rest.

A thin adapter is the cheap way to keep your options open while the Messages route is closed to you. It hides the SDK behind one function so the format becomes a configuration choice. The adapter below omits temperature on purpose, for the portability reason given above.

adapter.py: format as configuration
import os

FORMAT = os.environ.get("LLM_FORMAT", "anthropic")   # "anthropic" or "openai"
# anthropic: origin only, for example https://api.oneaiapikey.com
# openai:    origin plus /v1, for example https://api.oneaiapikey.com/v1


def complete(system: str, user: str, max_tokens: int = 300) -> str:
    base, key, model = os.environ["LLM_BASE_URL"], os.environ["LLM_API_KEY"], os.environ["LLM_MODEL"]
    if FORMAT == "anthropic":
        import anthropic

        r = anthropic.Anthropic(base_url=base, api_key=key).messages.create(
            model=model, max_tokens=max_tokens, system=system,
            messages=[{"role": "user", "content": user}],
        )
        return "".join(b.text for b in r.content if b.type == "text")
    from openai import OpenAI

    r = OpenAI(base_url=base, api_key=key).chat.completions.create(
        model=model, max_tokens=max_tokens,
        messages=[{"role": "system", "content": system}, {"role": "user", "content": user}],
    )
    return r.choices[0].message.content

To point it at the free lane, set four variables. The free id comes from the live free lane, and the free models page lists the rest.

Environment, OpenAI-format free lane
export LLM_FORMAT="openai"
export LLM_BASE_URL="https://api.oneaiapikey.com/v1"
export LLM_API_KEY="$ONEAIAPIKEY_API_KEY"
export LLM_MODEL="deepseek-deepseek-v4.1-flash:free"   # a free id from the free lane

The exit-plan side of this is the subject of the vendor lock-in exit plan, and the gateway or direct API decision flow says when to skip a gateway entirely.

How do you test a Messages endpoint without naming a Claude model?

Run the same short script against every route you consider. It uses only the Python standard library, takes the model id from an environment variable so the script never names one, and keeps every call tiny.

probe.py: eight checks on a Messages endpoint
import json
import os
import urllib.error
import urllib.request

BASE = os.environ["PROBE_BASE_URL"].rstrip("/")   # origin only, no /v1
KEY = os.environ["PROBE_API_KEY"]
MODEL = os.environ["PROBE_MODEL"]                 # an id you chose; the script never names one
VERSION = os.environ.get("PROBE_VERSION", "2023-06-01")


def call(path, body=None, key=KEY, version=VERSION):
    data = json.dumps(body).encode() if body is not None else None
    req = urllib.request.Request(BASE + path, data=data, method="POST")
    req.add_header("content-type", "application/json")
    req.add_header("x-api-key", key)
    req.add_header("anthropic-version", version)
    try:
        return urllib.request.urlopen(req, timeout=60)
    except urllib.error.HTTPError as e:
        return e


def ask(content, **extra):
    body = {"model": MODEL, "max_tokens": 32, "messages": [{"role": "user", "content": content}]}
    body.update(extra)
    resp = call("/v1/messages", body)
    return resp.getcode(), json.loads(resp.read() or b"{}")


def text_of(msg):
    return "".join(b.get("text", "") for b in msg.get("content", []) if b.get("type") == "text")


rows = []


def check(name, fn):
    try:
        rows.append((name, "PASS", fn() or ""))
    except Exception as e:
        rows.append((name, "FAIL", (type(e).__name__ + ": " + str(e))[:90]))


def plain():
    status, m = ask("Reply with the single word OK.")
    assert status == 200, "HTTP " + str(status)
    assert m.get("type") == "message" and m.get("role") == "assistant", "not a message object"
    u = m.get("usage", {})
    assert u.get("input_tokens", 0) > 0 and u.get("output_tokens", 0) > 0, "usage missing"
    assert m.get("stop_reason") in ("end_turn", "max_tokens"), "stop_reason " + str(m.get("stop_reason"))
    return "in=" + str(u["input_tokens"]) + " out=" + str(u["output_tokens"])


def model_echo():
    status, m = ask("Reply with the single word OK.")
    assert m.get("model") == MODEL, "asked for " + MODEL + ", reply names " + str(m.get("model"))


def system_prompt():
    status, m = ask("What is 2 + 2?", system="Always answer with the word PINEAPPLE and nothing else.")
    assert "PINEAPPLE" in text_of(m).upper(), "system prompt ignored: " + text_of(m)[:40]


def max_tokens():
    status, m = ask("Count from 1 to 50 in words.", max_tokens=5)
    assert m.get("stop_reason") == "max_tokens", "stop_reason " + str(m.get("stop_reason"))


def stream():
    body = {"model": MODEL, "max_tokens": 32, "stream": True,
            "messages": [{"role": "user", "content": "Reply with the single word OK."}]}
    resp = call("/v1/messages", body)
    assert resp.getcode() == 200, "HTTP " + str(resp.getcode())
    events = []
    for raw in resp:
        line = raw.decode().strip()
        if line.startswith("event:"):
            events.append(line[6:].strip())
    assert events and events[0] == "message_start", "first event " + str(events[:1])
    assert "content_block_delta" in events, "no content_block_delta"
    assert events[-1] == "message_stop", "last event " + events[-1]
    assert "message_delta" in events, "no message_delta (final usage)"


TOOL = {"name": "get_weather", "description": "Current weather for a city",
        "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}


def tool_loop():
    ask_user = {"role": "user", "content": "What is the weather in Paris? Use the tool."}
    body = {"model": MODEL, "max_tokens": 200, "tools": [TOOL], "messages": [ask_user]}
    resp = call("/v1/messages", body)
    first = json.loads(resp.read())
    assert resp.getcode() == 200 and first.get("stop_reason") == "tool_use", "no tool_use"
    use = next(b for b in first["content"] if b.get("type") == "tool_use")
    assert isinstance(use.get("input"), dict) and use["input"].get("city"), "tool input not an object"
    body["max_tokens"] = 100
    body["messages"] = [ask_user, {"role": "assistant", "content": first["content"]},
                        {"role": "user", "content": [{"type": "tool_result", "tool_use_id": use["id"],
                                                      "content": "18 C, cloudy"}]}]
    resp = call("/v1/messages", body)
    final = json.loads(resp.read())
    assert resp.getcode() == 200 and text_of(final), "no final text after tool_result"


def count_tokens():
    resp = call("/v1/messages/count_tokens", {"model": MODEL, "messages": [{"role": "user", "content": "Hello"}]})
    if resp.getcode() == 404:
        return "not offered (optional)"
    n = json.loads(resp.read()).get("input_tokens")
    assert isinstance(n, int), "no input_tokens"
    return "input_tokens=" + str(n) + " (read the docs: estimate or exact?)"


def error_shape():
    resp = call("/v1/messages", {"model": MODEL, "max_tokens": 8, "messages": [{"role": "user", "content": "hi"}]},
                key="not-a-real-key")
    body = json.loads(resp.read() or b"{}")
    assert resp.getcode() == 401, "bad key gave HTTP " + str(resp.getcode())
    assert body.get("type") == "error", "401 body is not Anthropic's error shape"


def new_version_note():
    resp = call("/v1/messages", {"model": MODEL, "max_tokens": 16, "temperature": 0.2,
                                 "messages": [{"role": "user", "content": "Reply with OK."}]}, version="2026-10-21")
    return "version 2026-10-21 plus temperature: HTTP " + str(resp.getcode())


for name, fn in [("plain message", plain), ("model id echoed", model_echo), ("system prompt", system_prompt),
                 ("max_tokens honoured", max_tokens), ("stream events", stream), ("tool round trip", tool_loop),
                 ("count_tokens", count_tokens), ("error shape on 401", error_shape)]:
    check(name, fn)
for name, verdict, note in rows:
    print(verdict.ljust(5), name.ljust(22), note)
print("NOTE ", "new version header".ljust(22), new_version_note())
Run it
export PROBE_BASE_URL="https://your-route.example.com"   # origin, no /v1
export PROBE_API_KEY="a-capped-test-key"
export PROBE_MODEL="the-id-you-want-to-test"
python probe.py

The eight checks, and what a FAIL means:

  1. Plain message. HTTP 200, a message object with an assistant role, a stop_reason, and usage with both input and output tokens above zero. A FAIL here usually means the endpoint speaks the OpenAI shape, not Messages.
  2. Model id echoed. The model field of the reply equals the id you sent. A FAIL is either a documented alias map (DeepSeek’s claude* mapping would show up here) or something you should ask the operator about.
  3. System prompt. A system instruction is obeyed. A route that drops the system field fails this check.
  4. max_tokens honoured. With max_tokens set to 5, the reply stops with max_tokens. DeepSeek’s page warns that for some Claude Code and OpenCode thinking-mode requests, compatibility handling can raise the effective max_tokens, so a FAIL there is worth reading about.
  5. Stream events. The event sequence starts with message_start, contains content_block_delta and message_delta, and ends with message_stop. This is the check that catches a buffering proxy.
  6. Tool round trip. The model returns a tool_use block with an object input, you send a tool_result, and a final text comes back. It passes the whole assistant content array back, which thinking models need.
  7. count_tokens. Reported, not graded: a 404 means not offered, which Claude Code tolerates, and a number needs a docs read to learn whether it is exact or an estimate. Ours is an estimate and says so.
  8. Error shape. A bad key returns HTTP 401 with a body whose type is error. SDKs raise errors from the status either way, but tools that parse the body care.

The last line prints one more fact rather than a verdict: what the route answers when you send anthropic-version: 2026-10-21 with a temperature field. HTTP 400 means the route follows the newest Anthropic rules, HTTP 200 means it ignores the header or the field.

What does the probe cost? Eight billed calls: plain, model echo, system, max_tokens, stream, two for the tool loop and the version note. The count_tokens call is free here and the bad-key call is rejected before any model runs. Count the ceiling by max_tokens: 32 plus 32 plus 32 plus 5 plus 32 plus 200 plus 100 plus 16 is 449 output tokens at most, and roughly 200 input tokens per call is 1,600. At a $2 input and $10 output rate that is 1,600 × $2 ÷ 1,000,000 + 449 × $10 ÷ 1,000,000 = $0.0032 + $0.0045 = $0.0077, under one cent. At deepseek-flash peak rates it is about a tenth of that. A thinking model can spend extra tokens on thought, so create the key with a spend limit anyway.

Our own docs say the same about test keys: make a separate key per experiment with a spend limit, an expiry and a model list in the console, so a mistake costs at most the limit. The 8-test gateway protocol extends this to billing movement and support replies, and the OpenAI-compatible provider matrix does the same job for the other format.

Which route fits your situation?

What are you trying to do?

Keep Claude, change the bill or region

Use a cloud platform from the table, or the first-party API through a gateway that forwards anthropic-beta and anthropic-version unchanged. Read the gateway versus direct guide first: for one team and one vendor, direct is often the right answer.

One key, budgets and logs across teams

A gateway fits. Cloudflare and LiteLLM suit you if you already run their stack, Vercel suits a Vercel project, and the gateway comparison covers the rest. Check the batch and count_tokens lines before you commit.

A cheaper model behind the same SDK

Try a vendor endpoint such as DeepSeek or Z.ai, or a gateway route, with the probe and your own prompts. Read the ignored-fields list, watch the model echo, and use the fallback guide so one outage does not stop you.

I use Claude Code

Anthropic does not support non-Claude models through a gateway, so stay with a supported route for Claude and treat anything else as an experiment on a capped key. Our Claude Code guide shows the variables, and the trial credit post says what a free try involves.

I want to test non-Claude models today for free

Use the OpenAI-format free lane with the adapter above: Google sign-in, no card, a daily cap printed on the free models page. It does not test the Messages format, only whether your prompts hold up on other models.

What should you check before you flip the variable?

Before you change the base URL

0 of 8 done

Not ready

Start with the version header and the feature list: they find most breakage.

How do you switch without a bad week?

Treat the swap as a drill with an exit at every step. The diagram is the order we would use, and it is the same shape the exit plan post uses for any vendor.

A 30-minute switch drill

Create a capped test keyspend limit, expiry, model listRun the probeeight checks, under one centReplay 20 real promptscompare stop reasons and tool callsSend 5 percent of trafficcanary behind an env varRead the bill, then widenusage against your own counts
The slow part is step three, because it needs your own prompts. Step five is the one people skip: compare reported usage with your own token count, as the billing audit post shows.

Set the environment variables first, since a tool that reads ANTHROPIC_BASE_URL needs no code edit:

Environment for an Anthropic SDK
# Anthropic SDKs read both variables, so code that calls anthropic.Anthropic() with no arguments needs no edit
export ANTHROPIC_BASE_URL="https://api.oneaiapikey.com"     # origin only: the SDK adds /v1/messages itself
export ANTHROPIC_API_KEY="paste-the-new-key-here"

# Claude Code sends ANTHROPIC_AUTH_TOKEN as a Bearer header and ANTHROPIC_API_KEY as x-api-key.
# Use the one your route's docs name; this gateway accepts either header.

Then keep the runaway case in mind. A retry loop on a cheaper model is still a loop, and the post on runaway agent token bills lists six caps; one of them, a per-key spend limit, is a console setting here. If a test key ever leaks into a repository, the first-hour checklist tells you what to do, and our key security guide covers storage. For the money side, the prepaid credits guide explains what prepaid means, and the flat-plan arithmetic post shows why unusually cheap Claude access should make you ask questions, using published rate cards. The wider risk picture sits in the reseller risk research, and the OpenRouter move to Stripe post covers what is and is not known about that row of the table.

What should you do next?

If you are on Anthropic’s API today and happy, you do not need an alternative; keep a second route written down. If the pain is price, an outage or a region, pick two rows from the table, run the probe on each with a capped key, and compare the answers to your own prompts. If you want to try the non-Claude side without paying, our free lane is open after a Google sign-in, with limits printed on the pricing page and the quickstart showing the first call. Everything we say here that concerns another company is from its own page on the date given; if a page has changed since, trust the page.

Try the free lane before you plan a switch

$10 sign-up credit, 48 free models sharing 100 requests and 3,000,000 tokens a day, no card.

Frequently asked questions

Can I keep the Anthropic SDK and still leave Anthropic?
Yes, for the SDK. Anthropic's own client libraries take a base_url, and nine routes in the table above document an endpoint that speaks the Messages format. What changes is the model behind the URL and the features that route supports. The Messages tutorial walks through the request, and the Messages reference lists what One AI API Key forwards.
Does a different base URL change what I pay?
It can. The model rate changes, a gateway may add a fee on credit purchases (OpenRouter's FAQ says 5.5 percent with a $0.80 minimum), and a different tokenizer changes how many tokens the same text becomes. The calculator above puts all three in one bill, and the gateway fee comparison covers the fee side.
Will Claude Code work with a non-Claude model through a gateway?
Anthropic's gateway page says it does not support routing Claude Code to non-Claude models through any gateway, so a setup that does is outside what Anthropic tests. DeepSeek and Z.ai publish Claude Code setups for their own models, and OpenRouter documents the variables. Treat it as a community route and read the relay safety checklist before you run any installer. Our Claude Code guide shows the variables for this gateway.
Are the Claude models available on One AI API Key today?
Not today. On 28 November 2026 the models list shows 4 ids that carry the Anthropic protocol, and every one is marked unavailable. Do not build on them. Paid models are set up by hand, offline: email somdutt777@gmail.com and ask what is open before you plan around a Claude id. The post on paid access by email explains why.
What can I test on this gateway for free right now?
The OpenAI-format free lane: 48 ids share 100 requests and 3,000,000 tokens a day, with a Google sign-in and no card. Those ids are served in the OpenAI format only. If your code has a thin adapter like the one above, you can try non-Claude models today. The free models page lists the ids, and the OpenAI SDK alternatives guide covers the two-line change.
How do I know a route really serves the model I asked for?
Read the model field of the reply, ask a question only that model family can answer in a distinctive way, and compare token counts with your own count. The probe in this post checks the echoed id. The six-check guide goes further, and the study explainer covers the academic audit of substitute-model services.
What breaks first when I swap the base URL?
In our experience of reading these docs: the version header and sampling fields (a field that is valid on one route can be a 400 on another), features outside Messages and chat such as Batches and Files, prompt caching that a route ignores, and streaming that a proxy buffers. The 8-test gateway protocol and the probe here catch most of them in a few minutes.
Should I use a gateway or call a cloud platform directly?
If compliance, a cloud commitment or a regional endpoint decides, use the cloud platform: Anthropic's overview lists Amazon Bedrock, Google Cloud, Microsoft Foundry and Claude Platform on AWS for that. If you want one key, budgets and routing across vendors, a gateway fits. The gateway versus direct decision flow sets out when each wins.
More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →