Claude API Base URL: How to Set the Custom Endpoint in Every Client

Almost every AI client — a CLI, an editor, a desktop chat app, an orchestration framework — lets you point it at a custom base URL instead of the default vendor endpoint. Set that one field correctly and the exact same tool sends its requests to ApiTopMix instead. Get it slightly wrong — a stray /v1, a trailing slash, http instead of https — and you stare at a 404 or a 401 with no obvious cause. This page is the reference that removes the guesswork: for each popular client it tells you which base URL to use, where to paste it, and where the API key goes.

A base URL (sometimes called the API endpoint, host, or server address) is simply the root address your client prepends to every API path. When a client ships, that root points at the model vendor. Overriding it — the custom base URL — is the supported hook that lets a gateway like ApiTopMix stand in front of the models. You change the address, not the app: prompts, projects and workflows are untouched, and the override is reversible at any time.

The two ApiTopMix base URLs

ApiTopMix publishes two base URLs, and picking the right one is the whole game. The distinction is which protocol your client speaks:

Both accept the same ApiTopMix sk- key. The rule of thumb: if the client mentions "OpenAI" anywhere in its API settings, use the /v1 base; if the client is Claude-native and talks about ANTHROPIC_BASE_URL, use the bare host.

The /v1 gotcha — read this first. Some clients expect the base URL to already end in /v1 and append the rest of the path (/chat/completions) themselves. Others expect a bare host and add /v1/... for you. If you see /v1/v1/chat/completions in an error, you doubled it — remove the /v1 you typed. If you get a 404 on a plain host, the client did not add /v1 — put it back. When in doubt, the OpenAI-SDK convention is base URL with /v1; the Anthropic convention is base URL without it.

The base URL reference table (per client)

This is the core of the page. Find your client, use the base URL in column two, paste it where column three says, and put the ApiTopMix key where column four says. The OA tag means the OpenAI-compatible base https://apitopmix.com/v1; the AN tag means the Anthropic-native base https://apitopmix.com.

ClientBase URL to useWhere you paste itWhere the API key goesHow & gotcha
OpenAI Python SDK OA https://apitopmix.com/v1 base_url= in OpenAI(...) api_key= argument Set base_url once at client init. Include /v1; the SDK adds /chat/completions.
OpenAI Node SDK OA https://apitopmix.com/v1 baseURL: in new OpenAI({...}) apiKey: field Same as Python. baseURL must end in /v1; do not append /chat/completions yourself.
Claude Code AN https://apitopmix.com ANTHROPIC_BASE_URL env var ANTHROPIC_AUTH_TOKEN env var No /v1 here — Claude Code adds /v1/messages itself. Export both vars, then run claude.
Cursor OA https://apitopmix.com/v1 Settings → Models → Override OpenAI Base URL OpenAI API Key field Enable the OpenAI key section, keep the /v1 suffix, and add a custom model name.
Cline (VS Code) OA https://apitopmix.com/v1 API Provider → "OpenAI Compatible" → Base URL API Key field in the same panel Pick the OpenAI Compatible provider (not "OpenAI"). Base URL keeps /v1; enter the model ID manually.
Roo Code (VS Code) OA https://apitopmix.com/v1 Provider → "OpenAI Compatible" → Base URL API Key field Same family as Cline. Choose OpenAI Compatible, keep /v1, set the model name explicitly.
Continue.dev OA https://apitopmix.com/v1 apiBase in the model block of config.yaml/config.json apiKey in the same model block Use provider: openai with apiBase ending in /v1. One block per model you want to list.
ChatBox OA https://apitopmix.com/v1 Settings → Model Provider "OpenAI API" → API Host API Key field Set API Host to the /v1 base. If ChatBox shows /v1 greyed as a suffix, enter only https://apitopmix.com — do not double it.
Cherry Studio OA https://apitopmix.com/v1 Settings → Model Providers → API Address / 端点 API Key field for that provider Cherry Studio auto-appends /v1 unless the URL ends with /. Enter https://apitopmix.com to let it add /v1, or https://apitopmix.com/v1/ to force it verbatim.
Open WebUI OA https://apitopmix.com/v1 Admin → Settings → Connections → OpenAI API Base URL API Key field next to the URL Include /v1. After saving, refresh the model list so ApiTopMix models appear in the picker.
Dify OA https://apitopmix.com/v1 Settings → Model Provider → "OpenAI-API-compatible" → API endpoint URL API Key field in the same dialog Use the OpenAI-API-compatible provider for a Dify custom model base URL, keep /v1, and type the exact model name.
LangChain OA https://apitopmix.com/v1 base_url= on ChatOpenAI(...) api_key= argument (or OPENAI_API_KEY) Pass base_url to ChatOpenAI. It ends in /v1; LangChain appends the path.
LlamaIndex OA https://apitopmix.com/v1 api_base= on the OpenAI LLM class api_key= argument Note the field is api_base (not base_url). Keep the /v1 suffix.
curl OA https://apitopmix.com/v1 Full URL in the request line Authorization: Bearer header You type the whole path yourself: .../v1/chat/completions. No SDK magic, so no double-/v1 risk.

Fourteen clients, one pattern: OpenAI-shaped tools take https://apitopmix.com/v1 and Claude-native tools take https://apitopmix.com as ANTHROPIC_BASE_URL. If your client is not listed but exposes an "OpenAI compatible base URL" field, treat it exactly like the OA rows above.

Copy-paste snippets for the most common clients

OpenAI Python SDK

from openai import OpenAI

client = OpenAI(
    base_url="https://apitopmix.com/v1",   # note the /v1
    api_key="sk-your-apitopmix-key",
)

resp = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Say hi from Claude"}],
)
print(resp.choices[0].message.content)

curl (OpenAI-compatible endpoint)

curl https://apitopmix.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-apitopmix-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"ping"}]}'

Claude Code (Anthropic-native env vars)

export ANTHROPIC_BASE_URL=https://apitopmix.com      # no /v1
export ANTHROPIC_AUTH_TOKEN=sk-your-apitopmix-key
claude

Cursor (Base URL override)

Settings → Models → enable OpenAI API Key → turn on Override OpenAI Base URL:

# Base URL field:
https://apitopmix.com/v1
# API Key field:
sk-your-apitopmix-key
# Custom model to add:
claude-sonnet-4-6

For the full Claude-Code-and-Cursor walkthrough, see Use Claude Code & Cursor and the dedicated Claude in Cursor guide.

Common mistakes when setting the base URL

Quick sanity check: if a request reaches the server and comes back authenticated but wrong model, your base URL is correct and only the model name is off. If it comes back 404, suspect the /v1 path. If it comes back 401, suspect the key or header. Isolating which of the three you see tells you exactly what to fix.

Frequently asked questions

What is the Claude API base URL for ApiTopMix?

Two values. The OpenAI-compatible base URL is https://apitopmix.com/v1 — use it for OpenAI-SDK-style clients. The Anthropic-native base is https://apitopmix.com — set it as ANTHROPIC_BASE_URL for Claude Code and Anthropic SDKs. Both use the same ApiTopMix key, so which one you pick depends only on the protocol your client speaks.

Should the base URL include /v1 or not?

OpenAI-SDK clients expect the base URL to already end in /v1 and append /chat/completions themselves, so you enter https://apitopmix.com/v1. Anthropic clients like Claude Code expect the bare host https://apitopmix.com and add /v1/messages for you. Seeing /v1/v1 in an error means remove your /v1; a 404 on a bare host means add it.

What is the difference between the OpenAI-compatible base URL and the Anthropic base URL?

The OpenAI-compatible base (https://apitopmix.com/v1) speaks the OpenAI protocol and serves /v1/chat/completions. The Anthropic-native base (https://apitopmix.com) speaks the Anthropic protocol and serves /v1/messages. Cursor, Cline, ChatBox, Cherry Studio, Open WebUI and Dify use the OpenAI-compatible base; Claude Code and Anthropic SDKs use the native one.

How do I set the base URL in Cursor?

Open Cursor Settings → Models, enable the OpenAI API Key section, turn on Override OpenAI Base URL, and set it to https://apitopmix.com/v1 with the /v1 suffix. Paste your ApiTopMix key and add a custom model name such as claude-sonnet-4-6. See the Cursor guide for the full flow.

What base URL does Claude Code use?

Claude Code reads ANTHROPIC_BASE_URL. Set it to https://apitopmix.com (no /v1) and ANTHROPIC_AUTH_TOKEN to your ApiTopMix key, then run claude. Claude Code appends /v1/messages itself, so the native Anthropic protocol runs end to end.

Why do I get a 401 after changing the base URL?

A 401 with a reachable URL almost always means the key or header is wrong, not the base URL. OpenAI-style clients send Authorization: Bearer sk-your-key. Confirm you pasted the full ApiTopMix key with no stray space or newline and no leftover placeholder. The base URL being reachable but returning 401 actually confirms your routing is correct.

Can one base URL serve both Claude and other models?

Yes. The OpenAI-compatible base https://apitopmix.com/v1 serves many model families through one endpoint. You choose the model with the model field in each request, so the same base URL and the same key call different models by changing only that field.

Do I need http or https for the base URL?

Always https. The ApiTopMix bases are https://apitopmix.com/v1 and https://apitopmix.com. Plain http fails or redirects, and some clients refuse it for API keys. Don't add a port, and avoid a trailing slash unless the client explicitly needs one. If Claude Code or another client still errors after you fix the base URL, work through the base URL troubleshooting guide.

One base URL, every client

Grab an ApiTopMix key, paste the base URL into your client, and route the whole Claude family through a single endpoint.

Related guides

Conclusion

Setting a custom base URL is the single most reusable skill for working with AI clients, because it is the same move everywhere: find the base-URL field, decide whether the client wants the OpenAI-compatible https://apitopmix.com/v1 or the Anthropic-native https://apitopmix.com, mind the /v1 convention, and drop in your key. Once you internalize the OpenAI-vs-Anthropic split and the /v1 gotcha, every new tool — this year's editor, next year's framework — is a two-minute configuration rather than an afternoon of trial and error.

Bookmark this page as your endpoint cheat sheet. When a client isn't listed, match it to the closest row above, apply the same base URL and key placement, and it will route through ApiTopMix the same way. From there, the model name is the only thing you ever change.

More guides: Claude Haiku API · Gemini API · DeepSeek API · Claude Opus API · Claude Sonnet API · Suno API · GPT-5 API · Claude in Cursor · Claude in Cline / Roo Code · Claude Code without a subscription · Cheap Claude API · Base URL troubleshooting · GPT-5.6 API