DeepSeek chat API
Use DeepSeek R1, V3.2, and V4 for chat, streaming, reasoning, and function calls.
Use an Official Group API key with the base URL https://app.apipool.dev/v1. Open an available model from the DeepSeek catalog for its playground and current price.
Models and capabilities
| Model ID | Text and streaming | Function calls |
|---|---|---|
deepseek-r1 | Yes | Unavailable |
deepseek-r1-0528 | Yes | Unavailable |
deepseek-v3.2 | Yes | Yes |
deepseek-v4-flash | Yes | Unavailable |
deepseek-v4-pro | Yes | Unavailable |
deepseek-v4.1-flash | Yes | Unavailable |
Use the model IDs exactly as shown, including deepseek-r1-0528. The listed models accept text messages. Images, PDF, and OCR inputs are unavailable. Check the catalog for current availability.
Non-streaming and streaming calls
curl https://app.apipool.dev/v1/chat/completions \
-H "Authorization: Bearer $APIPOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3.2",
"messages": [{"role": "user", "content": "Explain recursion in two sentences."}],
"max_tokens": 1024,
"stream": false
}'Omit stream for a non-streaming response and read choices[0].message.content. For streaming, set stream: true and stream_options: {"include_usage": true}. Assemble choices[].delta.content and read through data: [DONE], keeping the final usage.
When R1 returns reasoning_content or the streaming field delta.reasoning_content, read it separately from the answer. R1-0528 can include reasoning and a </think> marker directly in the answer text. Preserve that text. Reasoning and answer tokens share the output budget. finish_reason: "length" indicates truncation. Increase max_tokens if the task needs a longer output.
The playground caps output at 2,048 tokens. For longer reasoning answers, set the output budget through the API.
Function calling
deepseek-v3.2 accepts function tools and tool_choice. Your application executes each returned message.tool_calls entry and sends its result in a role: "tool" message.
{
"model": "deepseek-v3.2",
"messages": [{ "role": "user", "content": "Check the weather in Beijing." }],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Look up a city weather forecast.",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
}
],
"tool_choice": { "type": "function", "function": { "name": "get_weather" } },
"stream": false,
"max_tokens": 1024
}Pricing
Prices are in US dollars per million tokens. Input, cached input, and output each use their own rate. Output usage includes reasoning tokens.
| Model | Input | Cached input | Output |
|---|---|---|---|
| R1 | 0.476 | 0.476 | 1.904 |
| R1-0528 | 0.4335 | 0.4335 | 1.30917 |
| V3.2 | 0.21845 | 0.21845 | 0.327675 |
| V4 Flash | 0.364285 | 0.036428 | 1.092857 |
| V4 Pro | 1.092857 | 0.109285 | 3.278572 |
| V4.1 Flash | 0.242857 | 0.004811 | 0.971428 |
Rates stay the same throughout the day. A cache hit uses the cached-input rate for those tokens, and remaining tokens use the standard input rate. Check the model catalog for active prices and Usage for actual charges.
Parameters and troubleshooting
- Use
POST /v1/chat/completions. Responses, Messages, and text completion endpoints are unavailable for these models. - Use
system,user,assistant, ortoolfor message roles. Provide text incontent. - Optional fields include
max_tokens,temperature,top_p,frequency_penalty,presence_penalty,stop,seed, andresponse_format. Remove a field if the model rejects it. Sampling behavior can vary by model. - Built-in web search, explicit caching, passthrough containers, and image input are unavailable. Unsupported requests return HTTP 400.
- For HTTP 401, check your API key. If a model is unavailable, verify the Official Group and catalog status. For HTTP 429, reduce concurrency.
- After a disconnect, save
x-apipool-request-idand check usage records before retrying.