How to Use a DeepSeek API Tester to Validate Your Setup

You generated a key, pasted the base URL into your code, and the first call failed. Was it the key, the request body, the model name, or an empty balance? DeepSeek’s error codes narrow it down: 401 for a wrong API key, 402 for insufficient balance, 400 or 422 for a malformed body or an invalid parameter. A minimal test call isolates the cause before you debug application code. This guide covers curl, Postman, the OpenAI SDK, and web playgrounds, with copy-paste examples for deepseek-flash and deepseek-v4-pro against POST /chat/completions, a cache-billing checklist, and common errors with fixes: a repeatable smoke test to run before every deployment.
What a DeepSeek API tester actually does

DeepSeek API Tester
Configure a request — chat, streaming, JSON mode, function calling, thinking mode — and the tool writes the request code in six languages. It does not send anything; your key never leaves the page.
Generated code
Why doesn't this tool send the request from the browser?
Sending a request from this page would mean putting your API key into JavaScript running on a third-party website, which is unsafe. The tool only writes code; you run it on your own machine, where the key stays under your control.
Do the OpenAI SDKs work with DeepSeek?
DeepSeek's API uses an OpenAI-compatible format (and an Anthropic-compatible one at https://api.deepseek.com/anthropic), so the OpenAI SDKs work once you set base_url to https://api.deepseek.com. Thinking mode is on by default; with the OpenAI Python SDK the thinking field goes in extra_body, as DeepSeek's documentation shows. In thinking mode, temperature has no effect.
Run the generated snippet in your terminal or editor. Model names and parameters follow DeepSeek's official API documentation as checked by the site editors on 22 October 2026.
The request builder above is this page’s DeepSeek API Tester. It only generates request code (curl, Python and Node with the OpenAI SDK, browser fetch, PHP cURL, Go) and sends nothing; your key never leaves the page. Options: deepseek-flash (default) or deepseek-v4-pro; Thinking mode enabled (default) or disabled; Reasoning effort high (default), low or max; and a Temperature field marked “ignored in thinking mode”. Presets: chat, streaming, JSON mode (response_format json_object), function calling (tools) and reasoning (thinking on, effort max). The endpoint defaults to https://api.deepseek.com/chat/completions, and default bodies include "thinking": {"type": "enabled"} and "reasoning_effort": "high", with thinking passed via extra_body in Python and as a body field in Node, as in DeepSeek’s docs. Run the snippet locally; the curl and Go versions print the full response body.
More generally, an API tester is any script, GUI client, or playground that sends a request and shows the raw response, so you can tell whether a fault lies in your code, key, model name or the service. Verify five things:
- Authentication — does your bearer token work against
https://api.deepseek.com? - Model routing — does
deepseek-flash(ordeepseek-v4-pro) return what you expect? - Parameter behaviour — what changes when you toggle thinking, change
reasoning_effort, or enable JSON mode? - Token accounting — do
prompt_cache_hit_tokensandprompt_cache_miss_tokensmatch your billing assumptions? - Error shape — what does a deliberately broken request return?
The endpoint and model IDs you are testing against
The core tests in this article hit POST /chat/completions, the OpenAI-format chat endpoint. DeepSeek’s API format is compatible with OpenAI and Anthropic: point the OpenAI SDK at base URL https://api.deepseek.com, or the Anthropic SDK at https://api.deepseek.com/anthropic (Anthropic API guide).
As of 22 October 2026, the API offers deepseek-flash (DeepSeek-V4.1-Flash-1017) and deepseek-v4-pro (DeepSeek-V4-Pro-0813), both with a 1M-token context, a 384K maximum output, and thinking (the default, effort high) and non-thinking modes; only deepseek-flash accepts images. Per DeepSeek’s API Change Log, the V4 Preview launched on 24 April 2026 as deepseek-v4-pro and deepseek-v4-flash, V4-Pro reached general availability on 13 August 2026, V4.1-Flash arrived as deepseek-flash on 10 September 2026, and DeepSeek-V4.1-Flash-1017 has served that name since 17 October 2026.
Migrating older code? deepseek-chat and deepseek-reasoner were retired (scheduled for 24 July 2026, 15:59 UTC; until then they routed to deepseek-v4-flash in non-thinking and thinking mode respectively). deepseek-v4-flash and deepseek-v4-flash-vision-exp are still accepted but retired and served by DeepSeek-V4.1-Flash-1017 at the Flash price; new code should use deepseek-flash (or deepseek-v4-pro). The base_url stays the same, but thinking is now the default: send "thinking": {"type": "disabled"} (in Python, via extra_body) wherever you relied on non-thinking behaviour, or reasoning tokens appear and are billed as output. In thinking mode, temperature, presence_penalty and frequency_penalty have no effect.
Method 1: curl — the fastest sanity check
If you cannot get a curl call to work from your terminal, no SDK will save you. This is the simplest non-streaming test against deepseek-flash, with thinking disabled to keep it cheap:
curl -i https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Reply with the word OK."}
],
"thinking": {"type": "disabled"},
"stream": false
}'
Look for a 200 status, a choices[0].message.content string, and a usage object in which prompt_tokens equals prompt_cache_hit_tokens plus prompt_cache_miss_tokens and total_tokens is prompt plus completion (Chat Completions API reference). Populated fields mean your key, network path, and model name work. Without the thinking line it runs in thinking mode (the default, effort high), adding reasoning_content plus reasoning tokens, counted in completion_tokens_details.reasoning_tokens and billed as output.
For every parameter and response field, see the DeepSeek API documentation on this site.
Method 2: the OpenAI Python SDK
The official OpenAI SDK pointed at DeepSeek’s base URL mirrors what an SDK-based application does. This script exercises deepseek-v4-pro in thinking mode, with the fields as in DeepSeek’s Thinking Mode guide:
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-v4-pro",
messages=[{"role": "user", "content": "Outline a migration plan in three steps."}],
reasoning_effort="high",
extra_body={"thinking": {"type": "enabled"}},
)
choice = resp.choices[0]
print("FINISH:", choice.finish_reason)
print("REASONING:", getattr(choice.message, "reasoning_content", None))
print("FINAL:", choice.message.content)
print("USAGE:", resp.usage)
Thinking is on by default, so a populated reasoning_content does not prove your flag arrived. Rerun with "disabled" in place of "enabled" and no reasoning_effort line (the API reference says low, high and max switch thinking on): reasoning_content should then be absent or null. If an enabled call returns little or no answer, check finish_reason; length means max_tokens (or the 1M-token context limit) was reached. The script sets no cap because reasoning tokens count toward it; the thinking-mode default is 64K (128K at effort max).
For a deeper walkthrough, see DeepSeek API getting started and DeepSeek OpenAI SDK compatibility.
Method 3: Postman, Insomnia, and Bruno
GUI clients help when you share a test collection with teammates or non-engineers. Set up:
- Create a new request:
POST https://api.deepseek.com/chat/completions. - Add header
Authorization: Bearer {{DEEPSEEK_API_KEY}}and store the key as an environment variable, not in plain text. - Set body type to
raw / JSONand paste the same payload from the curl example. - Save as a collection so you can fork it for
deepseek-v4-pro, thinking on and off, JSON mode, function calling, and streaming.
Postman’s response viewer shows status, response time and headers; cache hits appear as prompt_cache_hit_tokens in the usage block. Bruno is an open-source alternative for keeping the collection in Git alongside your code.
Method 4: web-based playgrounds
Third-party playgrounds let you paste a key and call the API from the browser. They are handy on a borrowed machine, but you hand your key to a third party, so keep them for throwaway checks with a dedicated test key, such as comparing deepseek-flash and deepseek-v4-pro outputs on one prompt. This page’s request builder never transmits the key. Two jobs need no key:
- Token counts — the DeepSeek token counter gives a quick heuristic estimate, with the share of the 1M context and the input cost at peak and off-peak; the API’s
usageblock is authoritative. - Spend — a DeepSeek pricing calculator shows peak and off-peak costs side by side.
A repeatable smoke-test checklist
Whatever tool you use, run the same five tests every time you change keys, deploy a new model ID, or chase a regression:
| Test | What to send | What to confirm |
|---|---|---|
| Auth | Any valid request with the new key | HTTP 200, not 401 (Authentication Fails) |
| Model routing | model: "deepseek-flash" (or "deepseek-v4-pro") and a trivial prompt |
HTTP 200 and a response model field naming the model |
| Thinking mode | "thinking": {"type": "enabled"} + "reasoning_effort": "high", then {"type": "disabled"} without an effort |
reasoning_content present only on the enabled call |
| JSON mode | response_format: {"type": "json_object"}, with the word “json” and an example format in the prompt |
Output parses as JSON; finish_reason is stop |
| Cache accounting | Two identical calls at least a few seconds apart (cache construction takes seconds) | The second call should show non-zero prompt_cache_hit_tokens; caching is best-effort, so a miss is possible |
A footnote on JSON mode: DeepSeek’s API reference (checked 22 October 2026) says json_object “guarantees the message the model generates is valid JSON”, but you must also ask for JSON in a system or user message; otherwise the model may emit whitespace up to the token limit. DeepSeek’s JSON Output guide (checked the same day) adds: include the word “json” and an example format, set max_tokens high enough to avoid truncation, and expect occasional empty content. The dedicated DeepSeek API JSON mode page has fuller patterns.
Worked example: costing out a smoke test on deepseek-flash
If your smoke test runs nightly across a CI pipeline, costs add up. Here is illustrative arithmetic for 1,000 daily calls on deepseek-flash with thinking disabled: a 2,000-token system prompt assumed to hit the cache every time, a different 200-token user message (a cache miss), and a 300-token response. Rates as of 22 October 2026 (official pricing page), per 1M tokens: peak $0.006 cache hit / $0.30 cache miss / $1.20 output; off-peak $0.003 / $0.15 / $0.60 (DeepSeek has billed off-peak at half the peak rate since 16 August 2026). Peak hours are 01:00–04:00 and 06:00–10:00 UTC, Monday to Friday, excluding Chinese public holidays.
- Cached input: 2,000 × 1,000 = 2,000,000 tokens; 2,000,000 ÷ 1,000,000 × $0.006 = $0.012 (peak); × $0.003 = $0.006 (off-peak)
- Uncached input: 200 × 1,000 = 200,000 tokens; 200,000 ÷ 1,000,000 × $0.30 = $0.06 (peak); × $0.15 = $0.03 (off-peak)
- Output: 300 × 1,000 = 300,000 tokens; 300,000 ÷ 1,000,000 × $1.20 = $0.36 (peak); × $0.60 = $0.18 (off-peak)
- Daily total: $0.012 + $0.06 + $0.36 = $0.432 at peak; $0.006 + $0.03 + $0.18 = $0.216 off-peak. Over 30 runs: $12.96 if every run is at peak, $6.48 if every run is off-peak.
The time of the run decides the rate: a 02:00 UTC run on a weekday that is not a Chinese public holiday is billed at peak, while 12:00 UTC on a weekday, or any hour at weekends and on Chinese public holidays, is off-peak. All figures are exact; nothing was rounded.
The uncached-input line is easy to leave out: each new user message is a miss even when the system prompt hits cache. The cache assumption is optimistic, too: per DeepSeek’s Context Caching guide (checked 22 October 2026), a shared prefix only hits once it has been persisted, so a run’s first requests may miss; caching is best-effort; and an unused cache is usually cleared within hours to days. Check our DeepSeek API pricing page and DeepSeek API best practices for cache-friendly prompt design, and verify against the official DeepSeek pricing page before budgeting.
Common errors and how to read them
| Status | DeepSeek’s description | Fix |
|---|---|---|
| 400 | Invalid Format | Fix the request body using the hint in the error message |
| 401 | Authentication Fails (wrong API key) | Check the Authorization: Bearer header and the key |
| 402 | Insufficient Balance | Top up; any granted balance is used before topped-up funds |
| 422 | Invalid Parameters | Fix the parameter named in the error message |
| 429 | Rate Limit Reached | Back off and retry; per-account concurrency limits are 2,500 (deepseek-flash) and 500 (deepseek-v4-pro) |
| 500 | Server Error | Retry after a brief wait; contact DeepSeek if it persists |
| 503 | Server Overloaded | Retry after a brief wait |
| finish_reason: length | Output reached max_tokens or the context limit (not an HTTP error) |
Raise max_tokens (up to 393,216 = 384K) or shorten the input; with reasoning_effort “max” the default is already 128K |
HTTP codes and descriptions follow DeepSeek’s Error Codes page, and the concurrency limits come from its Rate Limit & Isolation page (both checked 22 October 2026). A wrong URL path or model name has no entry of its own on the Error Codes page; read the error message, and use deepseek-flash or deepseek-v4-pro. The API reference lists six finish_reason values: stop, length, content_filter (content omitted by DeepSeek’s content filters), tool_calls, insufficient_system_resource (interrupted for lack of inference resources on DeepSeek’s side) and aborted (generation interrupted). For a fuller catalogue, see DeepSeek API error codes.
Streaming, tool calls, and FIM — extending the test
Once the basic call works, test the surfaces your application uses:
- Streaming — set
stream: trueand confirm chunks arrive incrementally; in thinking modedelta.reasoning_contentprecedes the answer indelta.content, and the last chunk beforedata: [DONE]carriesusage. Details: DeepSeek API streaming. - Tool calling — declare a function and verify the model returns a
tool_callsobject; in thinking mode, passreasoning_contentback in later requests that carrytools, or the API returns 400 (Thinking Mode guide). See DeepSeek API function calling. - Context caching — a hit needs a full match of a cached prefix (Context Caching guide): resend the conversation plus a new turn (A + B, then A + B + C), or send three requests sharing a long prefix and check
prompt_cache_hit_tokenson the third, since A + B then A + C cannot hit. The DeepSeek context caching page covers prefix design. - FIM completion (Beta) — non-thinking mode only;
POST /completionswithbase_urlhttps://api.deepseek.com/beta; max 4K tokens (DeepSeek FIM guide, checked 22 October 2026). - Chat Prefix Completion (Beta) — end
messageswith an assistant message carrying"prefix": trueto pin the reply’s opening, withbase_urlhttps://api.deepseek.com/beta(Chat Prefix Completion guide).
For more utilities, see the collection of DeepSeek tools and utilities.
Verdict

You do not need a hosted testing service that holds your key. Generate the curl and SDK snippets with this page’s request builder, keep them with the checklist and a Postman collection your team can clone, and send the requests from your own machine. Rerun them after every key change and every model change, such as an update to the model behind deepseek-flash (most recently DeepSeek-V4.1-Flash-1017, 17 October 2026) or moving code off a legacy model name. A smoke-test run costs little; shipping a bad model= string to production costs more.
DeepSeek AI Guide is an independent resource and is not affiliated with DeepSeek or its parent company. Model IDs, pricing and API behaviour change; check the official DeepSeek documentation and pricing page before committing to a production decision.
Frequently asked questions
How do you test whether a DeepSeek API key works?
Send one curl call to POST /chat/completions with your bearer token, deepseek-flash, a trivial prompt and thinking disabled. A 200 response confirms the key, network path, and model name; a 401 means the API key is wrong, and a 402 that the balance has run out. See our get a DeepSeek API key guide for the full flow.
Which model ID should you use when testing the DeepSeek API?
Use deepseek-flash (DeepSeek-V4.1-Flash-1017) for new integrations and routine tests, and deepseek-v4-pro (DeepSeek-V4-Pro-0813) to compare or to check a workflow already validated on it. As of 22 October 2026, Pro costs 4.4× Flash on cache-miss input and 3.3× on output, at either period. The older IDs deepseek-chat and deepseek-reasoner were retired (scheduled for 24 July 2026, 15:59 UTC); deepseek-v4-flash is still accepted but retired and served by DeepSeek-V4.1-Flash-1017 at the Flash price. Background on the earlier generation is on our DeepSeek V4-Flash page.
Can Postman be used as a DeepSeek API tester?
Yes. Create a POST request to https://api.deepseek.com/chat/completions, add an Authorization: Bearer header, and paste a JSON body with model and messages fields. Save it as a collection so teammates can fork variants for streaming, JSON mode and function calling. The same payload works in Insomnia and Bruno — see DeepSeek API code examples.
Does the DeepSeek API behave the same as the chatbot?
No. The web chat and mobile app keep your conversation history; the API is stateless, so to sustain a multi-turn conversation your client must resend the full messages array on every request. The differences are covered in DeepSeek browser vs app.
Why does a DeepSeek JSON mode test return empty content?
DeepSeek’s JSON Output guide (checked 22 October 2026) says JSON mode may occasionally return empty content, an issue DeepSeek is working on; modifying the prompt can help. Also include the word “json” and an example format, and set max_tokens high enough: a cap that is reached (finish_reason length) cuts the JSON off, and in thinking mode (the default) reasoning tokens count toward the cap, so a low one can leave content empty. Handle empty responses defensively; the DeepSeek API JSON mode page has fuller examples.
Sources & Methodology
Primary sources
- OfficialDeepSeek API documentationEndpoints, request/response shape, model IDsLast checked: October 22, 2026
- PricingDeepSeek API pricing pagePer-1M-token rates, billing units, cache-hit pricingLast checked: October 22, 2026
- OfficialDeepSeek Chat Completions API referenceRequest fields (thinking, reasoning_effort, max_tokens defaults and 393,216 cap, response_format), usage fields, the six finish_reason valuesLast checked: October 22, 2026
- OfficialDeepSeek Thinking Mode guideThinking on by default (effort high), extra_body syntax, parameters ignored in thinking mode, passing reasoning_content back with toolsLast checked: October 22, 2026
- OfficialDeepSeek API Error CodesMeaning of HTTP 400, 401, 402, 422, 429, 500 and 503Last checked: October 22, 2026
- OfficialDeepSeek Rate Limit & IsolationPer-account concurrency limits (deepseek-flash 2,500; deepseek-v4-pro 500) and HTTP 429Last checked: October 22, 2026
- OfficialDeepSeek API Change LogDated model history (24 Apr, 13 Aug, 10 Sep, 17 Oct 2026) and legacy model-name routingLast checked: October 22, 2026
Technical references
- OfficialDeepSeek JSON Output guideJSON mode requirements and the occasional empty-content caveatLast checked: October 22, 2026
- OfficialDeepSeek Context Caching guideCache persistence and hit rules, cache construction taking seconds, best-effort caching, cache clearingLast checked: October 22, 2026
- OfficialDeepSeek FIM Completion (Beta) guideBeta base URL and 4K max tokens for FIMLast checked: October 22, 2026
- OfficialDeepSeek FIM Completion API referencePOST /completions endpoint for FIMLast checked: October 22, 2026
- OfficialDeepSeek Chat Prefix Completion (Beta) guideprefix flag on the last assistant message and the Beta base URLLast checked: October 22, 2026
- OfficialDeepSeek Anthropic API guideAnthropic-format base URL https://api.deepseek.com/anthropicLast checked: October 22, 2026
Context sources
- NewsDeepSeek news: DeepSeek V4 Preview Release (24 Apr 2026)Retirement time of deepseek-chat / deepseek-reasoner (24 Jul 2026, 15:59 UTC) and their routing until thenLast checked: October 22, 2026
- NewsDeepSeek news: DeepSeek-V4.1-Flash-1017 (17 Oct 2026)Current model behind deepseek-flashLast checked: October 22, 2026
Methodology
Checked against DeepSeek's official API documentation, pricing page and Change Log on 22 October 2026; code samples follow DeepSeek's official examples. We did not run our own tests; cost figures are arithmetic on the published peak and off-peak rates.
Data confidence
High for facts cited inline with primary-source links; medium for context narrative.
Editorial note
AI tooling moves quickly. If you spot an outdated number or a broken link, the contact link in the footer is the fastest way to flag it for the editorial team.
