DeepSeek Base URL: The Two Official Addresses, and Why Wrong Ones Still Return 401
DeepSeek documents two API base URLs: one for OpenAI-compatible clients and another for Anthropic-compatible clients. The OpenAI-compatible URL is https://api.deepseek.com, while the Anthropic-compatible URL is https://api.deepseek.com/anthropic. We also sent unauthenticated requests to several URL paths on 3 November 2026. All of the tested paths returned the same 401 response, including a path that does not exist. That result is useful when troubleshooting, but it does not prove how the gateway handles a request after a valid API key is supplied.
DeepSeek has two official base URLs: https://api.deepseek.com for OpenAI-format SDKs and tools, and https://api.deepseek.com/anthropic for Anthropic-format ones. We probed the gateway without a key on 3 November 2026 and every tested path returned the same 401 - the real endpoint, /v1 variants, and an address we invented all returned Authentication Fails identically. The useful consequence: a 401 tells you nothing about your base URL, so debug the key first. The Anthropic base URL is what lets tools like Claude Code run on DeepSeek models with two environment variables and no code.
The two official base URLs
DeepSeek's API speaks two dialects. It implements the OpenAI API format and the Anthropic API format, and each dialect has its own front door:
| You are using | Base URL |
|---|---|
| OpenAI SDK, or any OpenAI-compatible tool | https://api.deepseek.com |
| Anthropic SDK, or an Anthropic-compatible tool | https://api.deepseek.com/anthropic |
The model names are the same on both doors. What changes is the shape of the requests behind them — OpenAI-format tools speak messages + chat/completions, Anthropic-format tools speak their own messages schema. Pick the base URL that matches the SDK you already have, not the one that sounds more official.
What sits behind each base URL
With the OpenAI-format base URL, the paths DeepSeek documents are:
| Endpoint | What it does |
|---|---|
POST /chat/completions | The chat API itself - the only path most code ever needs |
GET /user/balance | Reads account balance, including the granted and topped-up wallets |
/anthropic/v1/messages | On the Anthropic base URL, the Messages endpoint the Anthropic SDK calls |
One thing you usually do not write yourself: OpenAI-format SDKs append /chat/completions to whatever base URL you give them. The official curl example posts to https://api.deepseek.com/chat/completions, which is exactly what the Python or Node SDK builds from base_url="https://api.deepseek.com". If your client also appends a version segment of its own, check its documentation before adding /v1 manually — doubled path segments are the classic way a correct URL becomes a 404.
Our probe: without a key, every tested path returned 401
We wanted to know which URL variants the gateway accepts, so we sent requests to eight addresses on 3 November 2026 with no API key at all. The results were not what we expected — they were more uniform than expected:
| Address we called | Status | Response |
|---|---|---|
api.deepseek.com/chat/completions (documented) | 401 | Authentication Fails |
api.deepseek.com/v1/chat/completions | 401 | Authentication Fails |
api.deepseek.com/models | 401 | Authentication Fails |
api.deepseek.com/v1/models | 401 | Authentication Fails |
api.deepseek.com/anthropic/v1/messages (documented) | 401 | Authentication Fails |
api.deepseek.com/bogus-nonexistent-xyz | 401 | Authentication Fails |
A path we made up returned exactly what the documented paths returned. That is consistent with authentication running before routing, but an unauthenticated probe cannot establish the order: a request with no key never gets far enough to show us what happens next.
That still changes one part of a common debugging order. If your calls fail with 401, it is not evidence your base URL is wrong. Fix the key first: is it present, is it the API key rather than something else, is the Authorization: Bearer header intact? A key that authenticates on a wrong path would presumably fail differently — but we cannot test that without a funded key, so treat the with-a-key behaviour as unverified. What the probe does support is narrower: in this unauthenticated test, a 401 did not distinguish a correct base URL from a wrong one.
The /v1 question, answered as far as we can
OpenAI users get an itch here: many OpenAI-compatible services want a version segment, and older DeepSeek documentation mentioned https://api.deepseek.com/v1 as an OpenAI-compatible form. The current official docs — checked 3 November 2026 — list only the bare https://api.deepseek.com, with no /v1 anywhere.
What we can add from our probe: /v1/... paths pass through the same auth gate and return the same 401 as everything else, so the gateway does not reject that prefix outright. What we cannot add, without a key, is confirmation of a successful end-to-end call through the /v1 form. So the guidance is simple: use what the docs list today — the bare domain for OpenAI-format tools — and only reach for /v1 if a specific tool refuses to work without it. The bare domain is the documented answer.
The Anthropic base URL: two environment variables, no code
The Anthropic-format door exists for one practical reason: tools built for Claude can then run on DeepSeek's models. The official guide reduces it to two exports:
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_API_KEY=your_deepseek_key
With that in place, an Anthropic SDK client created with no arguments talks to DeepSeek, using the same model names as everywhere else (deepseek-flash, deepseek-v4-pro). DeepSeek maintains integration guides for a list of agent tools on its documentation site — Claude Code, Codex, OpenCode, and others — so if your tool of choice is on that list, its guide will name the exact config fields; the base URL above is the value they all end up pointing at.
One identity check worth doing out loud: chat.deepseek.com is the consumer chat app, not an API host. If a tutorial tells you to point an SDK at it, the tutorial is mixing up DeepSeek's two products — code belongs on api.deepseek.com.
The four setup mistakes we would check first
- Chasing a 401 by changing the URL. Per our probe, the auth gate runs first, so no URL edit can fix a credential problem. Key first, URL second.
- Doubling the path. If the SDK appends
/chat/completions(most OpenAI-format clients do) and you paste a full endpoint URL into the base URL field, the client politely requests/chat/completions/chat/completions. Base URL fields want the base. - Mixing dialects. An OpenAI-format client pointed at the
/anthropicdoor, or the reverse, sends valid JSON to an audience that speaks a different schema. Match base URL to SDK, per the table at the top. - Using a domain that is not one of the official hosts. The official hosts are
api.deepseek.com,api-docs.deepseek.comandplatform.deepseek.com. Other deepseek-something domains are other services, and a base URL from one of them sends your prompts - and your key - somewhere else entirely.
Frequently asked questions
- What is the DeepSeek API base URL for OpenAI SDKs?
- https://api.deepseek.com - the bare domain, with no /v1 suffix in the current official documentation. The SDK appends /chat/completions itself, so a full call goes to https://api.deepseek.com/chat/completions.
- What base URL do I use for Claude Code or the Anthropic SDK?
- https://api.deepseek.com/anthropic, set as ANTHROPIC_BASE_URL, with your DeepSeek API key as ANTHROPIC_API_KEY. The model names stay deepseek-flash and deepseek-v4-pro.
- I get 401 Authentication Fails - is my base URL wrong?
- Probably not. Our probe on 3 November 2026 showed that every path on api.deepseek.com returns the same 401 without a valid key, including paths that do not exist. Fix the key first; only investigate the URL once authentication passes.
- Can I use https://api.deepseek.com/v1 as the base URL?
- Current official docs list only the bare domain. The /v1 form passes the same auth gate in our unauthenticated probe, but we could not verify an authenticated call through it without a key. Use the documented bare domain unless a specific tool requires the version segment.
Sources and what we could not test
| Claim | Where it came from | Date checked |
|---|---|---|
| Base URL values: api.deepseek.com (OpenAI format) and api.deepseek.com/anthropic (Anthropic format); model names | DeepSeek API docs · Your First API Call | 3 Nov 2026 |
| curl example posting to /chat/completions; Anthropic env vars ANTHROPIC_BASE_URL / ANTHROPIC_API_KEY | DeepSeek API docs · Using the Anthropic API | 3 Nov 2026 |
| 401 Authentication Fails on all probed paths, including a fabricated one | our own unauthenticated probe of api.deepseek.com, run 3 Nov 2026 | 3 Nov 2026 |
| GET /user/balance endpoint | DeepSeek API docs · Models & Pricing | 3 Nov 2026 |
| SERP competition level (front-page median 225 words, Bing index) | our own SERP probe, 2026-11-03 | 3 Nov 2026 |
We hold no funded DeepSeek API key, so every probe above is an unauthenticated response: we verified how the gateway treats missing credentials, not how it routes successful calls. The /v1 behaviour with a valid key, and the exact failure a wrong path returns after authenticating, are unverified.