deepseek4api.comGuide
DeepSeek API Docs Walkthrough and Drop-in Alternative
Most people who open the deepseek api docs want the same five answers: the base URL, how to authenticate, which model name to use, which parameters work, and what a working call looks like. This page covers those, then shows the same calls against a different OpenAI-compatible endpoint you can swap in.


Key points
- DeepSeek documents an OpenAI-style API, so the OpenAI SDK works by changing base URL, key and model name.
- This site is not DeepSeek's official API; it serves one independent open-weight model under the ID uncensored.
- The same code runs on both: only three values change.
- Context here is 100,000 tokens, with streaming, tools and JSON mode supported.
The five things the DeepSeek API docs answer
When developers search for the deepseek api docs, they are normally trying to complete a first request. The pattern is the same as for any OpenAI-style service, which is why a table makes it easy to compare.
| Question | DeepSeek's docs | This API |
|---|---|---|
| Base URL | Documented in their quick start (api.deepseek.com) | https://api.deepseek4api.com/v1 |
| Auth | Bearer token in the Authorization header | Bearer token in the Authorization header |
| Model name | Listed in their model docs; check the current names | uncensored |
| Main endpoint | Chat completions | Chat completions, Responses, models list |
| Pricing | Check their current pricing | $0.15 / 1M input, $0.50 / 1M output tokens |
Read DeepSeek's own pages for anything about their models, prices and limits; they change, and this article does not try to restate them. The point is that the request shape is shared, so moving between the two is a config change.
One thing to be clear about: this site is not DeepSeek's official API, and it is not a router to DeepSeek. It is a hosted, OpenAI-compatible endpoint serving one open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use.
Step 1: authentication and base URL
Create an account (Google, or email and password) and open the API key page. Copy the key. New users can also claim $0.50 of trial credit there with one click, valid for 7 days and needing no card.
Every request carries the header Authorization: Bearer YOUR_KEY. With curl:
curl https://api.deepseek4api.com/v1/models \
-H "Authorization: Bearer YOUR_KEY"
That lists the available model, uncensored. If you copy a DeepSeek example, replace three things: the base URL, the key and the model name. Nothing else needs to change.
Step 2: a chat completion in Python
The OpenAI SDK is what DeepSeek's docs use in their examples, and it works unchanged here:
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepseek4api.com/v1",
api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a concise technical assistant."},
{"role": "user", "content": "Explain idempotency in two sentences."},
],
temperature=0.7,
)
print(resp.choices[0].message.content)
print(resp.usage)
Supported sampling parameters, including temperature, top_p, stop, seed and the presence and frequency penalties, are passed through. max_tokens is optional because the completion can use whatever remains of the 100,000 token window.
Step 3: streaming, JSON mode and tools
Streaming
Set stream: true to receive server-sent events. Usage is reported at the end of the stream.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepseek4api.com/v1",
apiKey: process.env.API_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Write a haiku about caching." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
JSON mode
Pass response_format: {"type": "json_object"} and mention JSON in your prompt. The output is a JSON object you can parse directly.
Tool calling
The tools and tool_choice parameters work in the OpenAI format, tool calls stream back in deltas, and you return results as messages with role: "tool". If your code already does function calling against DeepSeek, it should port with the three-value change above, but test your own schemas.
Where the two differ
Same protocol does not mean same service. Things to check when you move a workload:
- Model behaviour. A different model gives different answers, reasoning style and refusal behaviour. Re-run your prompt set before switching anything in production.
- Reasoning-specific fields. If you depend on vendor-specific response fields from a particular DeepSeek model, do not assume they exist here. Standard chat completion fields do.
- Features not offered. This API is text only: no images, audio, video, embeddings or fine-tuning.
- Limits. A full key allows 8 concurrent requests and 300 per minute; a trial key allows 2 and 60. Over a limit you get HTTP 429 with
rate_limitedorconcurrency. - Balance. Check credit with
GET /v1/balance, the OpenAI-style credit grants route, or theX-Balance-USDheader on each response.
For a look at how a DeepSeek-focused user thinks about cost, see the DeepSeek pricing notes; for editor setups, the VS Code guide.
What a call costs here
Billing is prepaid and per token: $0.15 per 1M input tokens and $0.50 per 1M output tokens. A request with 1,500 input tokens and 600 output tokens costs 1,500 x $0.15 / 1M = $0.000225 for input plus 600 x $0.50 / 1M = $0.0003 for output, a total of $0.000525. A $20 top-up covers about 38,000 such calls.
Top-ups accept any whole amount from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200. You can pay by crypto (USDT on TRC20, USDC on Base). Credit never expires, and failed or refused requests are not charged. Details on the pricing page.
A migration checklist
If you are porting an app that already talks to DeepSeek, work through these in order. Each step takes minutes.
- Put the three values in config. Base URL, key and model name should come from environment variables, not constants scattered through the code.
- Run a smoke test. One chat completion, one streamed completion, one JSON mode call and one tool call. The four snippets above cover them.
- Replay real prompts. Take 30 prompts from your logs and compare answers side by side. Judge them against your own criteria rather than a generic score.
- Handle 429. Add retry with backoff and honour
Retry-After. A streamed request holds its concurrency slot until the stream ends, so close abandoned streams. - Watch cost. Log
usagefrom each response and compare it with theX-Balance-USDheader over a day of traffic. - Roll out gradually. Send 5 to 10 percent of traffic to the new endpoint first, then raise it.
Compare cost per task, not price per token, because different models use different numbers of tokens for the same job. For an open-ended check of how permissive writing models behave, the roleplay write-up is a useful companion.
Choosing between them
Use DeepSeek's own API when you specifically need a DeepSeek model, its vendor features or its official support. Use this endpoint when you want a hosted OpenAI-compatible model that answers without content refusals for lawful adult use, with simple prepaid billing and prompts that are not used for training. Plenty of teams will want both behind a config switch, which the shared protocol makes easy. Reference material for this API lives in the docs.
More guides
Questions and answers
Is this the official DeepSeek API?
No. It is an independent OpenAI-compatible endpoint serving one open-weight model under the ID uncensored. It is not DeepSeek's service and does not route to it.
Can I reuse my DeepSeek code?
If it uses the OpenAI SDK or the chat completions format, usually yes. Change the base URL, the key and the model name, then test your prompts.
Where do I find the model name?
Call GET /v1/models. This API serves a single model with the ID uncensored.
How long is the context window?
100,000 tokens for prompt plus completion.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.