DeepSeek OpenAI-Compatible API URL: Base URL, Models and Setup (2026)
The DeepSeek OpenAI-compatible API URL, in one table
If you only came for the address: the DeepSeek OpenAI-compatible API URL is https://api.deepseek.com. Put that in the base_url (or "API Base", "Endpoint", "Base URL") field of any OpenAI-compatible client, add your DeepSeek API key, and pick a current model name.
DeepSeek actually exposes several entry points on the same host. Which one you need depends on the protocol your tool speaks:
|
What you are connecting |
Base URL to enter |
Full request path the client ends up calling |
|---|---|---|
|
OpenAI SDK, Chat Completions |
|
|
|
OpenAI SDK, Responses API (e.g. Codex) |
|
|
|
Anthropic SDK / Claude Code |
|
|
|
Beta features (FIM completion, chat prefix completion) |
|
|
|
Model list (to test a key) |
|
|
Everything on this page comes from DeepSeek's own documentation, read on November 24, 2026: the first API call page, Models & Pricing, the change log, Thinking Mode and Error Codes. DeepSeek changes model names often; if this page and the docs disagree, trust the docs.
What about https://api.deepseek.com/v1?
Many tutorials and tools use https://api.deepseek.com/v1. Earlier versions of DeepSeek's docs said the /v1 form is accepted for OpenAI compatibility and that the v1 has nothing to do with the model version. The current docs list only the bare host.
The practical rule:
- If the tool asks for a base URL and appends
/chat/completionsitself (the OpenAI SDKs, most chat apps), enterhttps://api.deepseek.com. The/v1form usually works too, but the bare host is what the docs show today. - If the tool asks for the full endpoint URL, enter
https://api.deepseek.com/chat/completions. - Never enter both. Pasting the full endpoint into a base-URL field produces paths like
/chat/completions/chat/completions, and adding/v1to a tool that already adds it produces/v1/v1/.... Both end in a 404.
The general version of this problem, for any provider, is covered in OpenAI-compatible base URL: what to set.
Current model names (November 2026)
The URL has stayed the same for years. The model names have not, and an outdated model name is now the most common reason a "correct" DeepSeek config fails.
|
Model name to send |
What it runs |
Notes |
|---|---|---|
|
|
DeepSeek-V4.1-Flash-1017 |
Default choice. Thinking and non-thinking modes, vision input, 1M context. |
|
|
DeepSeek-V4-Pro-0813 |
Larger model; no vision input. DeepSeek extended its service past September 14, 2026. |
|
|
Routed to V4.1 Flash |
Legacy names still accepted; the original models are retired and billed at the Flash price. |
|
|
No longer documented |
The April 24, 2026 change log scheduled both names for discontinuation on July 24, 2026. Replace them. |
If an old config still says deepseek-chat or deepseek-reasoner, change the model name, not the URL. To see what your key can call right now, list the models (shown below).
Minimal working setup
Set the key as an environment variable first:
export DEEPSEEK_API_KEY="sk-..."curl
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-flash",
"messages": [{"role": "user", "content": "Hello"}],
"stream": false
}'Python (OpenAI SDK)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEEPSEEK_API_KEY"],
base_url="https://api.deepseek.com",
)
resp = client.chat.completions.create(
model="deepseek-flash",
messages=[{"role": "user", "content": "Hello"}],
extra_body={"thinking": {"type": "disabled"}}, # thinking is on by default
)
print(resp.choices[0].message.content)Node.js (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepseek.com",
apiKey: process.env.DEEPSEEK_API_KEY,
});
const resp = await client.chat.completions.create({
model: "deepseek-flash",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Two DeepSeek-specific details matter here:
- Thinking mode is on by default (effort
high). Turn it off with{"thinking": {"type": "disabled"}}; with the OpenAI SDK this goes insideextra_body. Set depth withreasoning_effort(low,high,max). The reasoning text comes back inreasoning_content, next tocontent. More on cross-provider switches in enabling thinking on an OpenAI-compatible API. - In thinking mode,
temperature,presence_penaltyandfrequency_penaltyare silently ignored. No error is returned, so a tuning change that "does nothing" may be this.
Where to paste it in common tools
Field names differ, but the mapping is always the same three values: URL, key, model.
|
Tool type |
Field |
Value |
|---|---|---|
|
OpenAI SDK (Python / Node) |
|
|
|
Chat apps and IDE plugins with an "OpenAI-compatible" provider |
API Base / Base URL |
|
|
Dify "OpenAI-API-compatible" plugin |
API Base URL |
|
|
Claude Code / Anthropic SDK |
|
|
|
Codex and other Responses API clients |
base URL |
|
|
LiteLLM |
|
|
Errors that point to a URL or config problem
|
HTTP status |
DeepSeek's meaning |
Usual cause in a new setup |
|---|---|---|
|
404 |
Not found |
Doubled path ( |
|
401 |
Authentication Fails |
Wrong key, a key from another provider, or a missing |
|
402 |
Insufficient Balance |
The account has no balance; top up on the DeepSeek platform |
|
400 / 422 |
Invalid Format / Invalid Parameters |
Unknown model name (often |
|
429 |
Rate Limit Reached |
Too many concurrent requests for the model's limit |
|
500 / 503 |
Server Error / Overloaded |
Retry with backoff |
A 401 actually tells you the URL is right: the request reached DeepSeek and failed on the key. A 404 means it never reached a valid route.
Verify the URL and key in one request
Before wiring DeepSeek into an app, run:
curl https://api.deepseek.com/models \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}"A 200 with a data array confirms the host, the key and the model IDs your account can use; the response also carries each model's context window, output limit and modalities. If you use a relay or gateway instead of DeepSeek directly, run the same call against that gateway's base URL. Our guide to what an OpenAI-compatible API is explains why the same three values work across providers.
A note on cost
DeepSeek bills per token with peak and off-peak rates: off-peak is half price, and peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday to Friday. On November 24, 2026, deepseek-flash listed $0.30 per million cache-miss input tokens and $1.20 per million output tokens at peak. Check the pricing page before you budget, and see LLM API pricing comparison for what a rate table leaves out.
FAQ
What is the DeepSeek OpenAI-compatible API URL?
https://api.deepseek.com. Use it as the base URL in an OpenAI-compatible client; chat requests go to https://api.deepseek.com/chat/completions.
Should I use https://api.deepseek.com or https://api.deepseek.com/v1?
Use https://api.deepseek.com, which is what the current docs show. Earlier docs said /v1 is also accepted for OpenAI compatibility and is unrelated to the model version, so tools that require it generally work. Do not add /v1 to a tool that already appends it.
What is the DeepSeek base URL for Claude Code or the Anthropic SDK?
https://api.deepseek.com/anthropic. Set it as ANTHROPIC_BASE_URL and use your DeepSeek key as the API key.
Why does deepseek-chat stop working?
DeepSeek announced on April 24, 2026 that the legacy names deepseek-chat and deepseek-reasoner would be discontinued on July 24, 2026. Switch to deepseek-flash or deepseek-v4-pro.
Why do I get 404 from the DeepSeek API?
Almost always a doubled path: the full endpoint pasted into a base-URL field, or /v1 added to a tool that adds it again. Check the final URL your tool calls.
The short version
Base URL https://api.deepseek.com (Anthropic format: /anthropic, beta features: /beta), model deepseek-flash or deepseek-v4-pro, key from the DeepSeek platform. Confirm all three with GET /models before you build on them, and treat deepseek-chat in an old config as the first thing to fix.