Introduction
DeepSeek V4.1 Flash is DeepSeek's high-throughput long-context model, served here on one OpenAI-compatible endpoint at /v1/chat/completions. It reads up to 1,048,576 tokens across at most 256 messages and can return up to 384,000 in one reply, with reasoning effort that defaults to high.
Messages carry text and images. Up to 128 tools with tool_choice, JSON output through response_format and SSE streaming ride on the same call, and billing is split across input, cached input and output tokens.
Key features & highlights
Long outputs from a Flash model
The reply ceiling is 384,000 tokens against a 1,048,576-token window. A complete extraction of a large document set, a long translation or a full test suite can come back as one response instead of being assembled from several calls that never saw each other's output.
Reasoning shares the output budget
This model reasons before it answers, and the reasoning comes out of max_tokens. A cap that is too small can be spent entirely on thinking: measured at 120 tokens, the reply came back with no content and the request was failed and refunded rather than billed as an answer.
Two effort settings on one body
reasoning_effort defaults to high, and low is the lighter setting for volume passes. Switching is one string on the same request, so a bulk sweep and a careful re-run of its failures share one integration.
Request parameters
| Parameter | Required | Description |
|---|---|---|
messages | Yes | Ordered turns, oldest first, at most 256. Content is a string, or an array of text and |
reasoning_effort | No | none, low or high, high by default. none skips the reasoning pass entirely, which is the only way to keep reasoning tokens off your bill — they are charged as output. |
stop | No | Up to 4 sequences, as a string or an array. The reply ends as soon as the model writes one of them, and the matched text itself is left out. at least 1 characters · at least 1 items · at most 4 items |
max_tokens | No | Caps the reply at 384,000. The default is 32,768, which truncates a long deliverable silently. |
tools | No | Up to 128 function definitions in one request. at most 128 items |
tool_choice | No | auto, none, required, or an object naming one function. |
response_format | No | Ask for a JSON object when the reply feeds a parser rather than a person. |
Pricing
Input $0.30 / Output $1.20 per 1 million tokens
Use cases
Whole-document extraction
Send an entire contract set or policy archive with response_format set to json_object and ask for every obligation or clause as structured rows. With room for 384,000 tokens of output, the full table comes back in one piece.
Codebase review with a long report
Put a whole service - handlers, migrations, tests - into one request and ask for defects with file and line. Nothing is pre-chunked, so a bug that spans a controller and a migration is still visible in a single pass, and the report has room for every finding.
Function-calling agents
Declare up to 128 tools in one request and let tool_choice decide whether the model may call them. Results return as tool-role messages, and reasoning_content on the assistant turn carries the previous step's thinking forward instead of restarting the plan.
Prompt guide & pro tips
A structured call you can adapt
POST https://api.spicyapi.ai/v1/chat/completions with {"model": "deepseek/v4.1-flash", "messages": [{"role": "system", "content": "Extract every obligation as JSON with keys party, duty, deadline and clause."}, {"role": "user", "content": "<the contract set>"}], "reasoning_effort": "low", "max_tokens": 60000, "response_format": {"type": "json_object"}}. Add "stream": true for long outputs, so tokens arrive while the rest is still being written. Extraction like this runs well at low effort; raise it to high only for the records that fail your validation.
Leave several thousand tokens of headroom
The default of 32,768 truncates a long deliverable silently, and reasoning is drawn from the same budget. Set max_tokens to the size of the deliverable plus room for thinking; the ceiling is 384,000.
What the schema rejects
File parts are rejected before the request is priced, reasoning_content is accepted on assistant messages only, and the 1,048,576-token window counts every message you send, including the system prompt and earlier tool results.
API quick start
curl --fail-with-body -sN https://api.spicyapi.ai/v1/chat/completions \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "deepseek/v4.1-flash/chat",
"messages": [
{
"role": "user",
"content": "Summarise the following release notes into three bullet points."
}
],
"stream": true
}' \
| jq --unbuffered -Rrj 'select(startswith("data: ")) | .[6:] | select(. != "[DONE]") | fromjson | if .error then "\n[error] \(.error.message)\n" else (.choices[0].delta.content? // empty) end'
See the API reference for authentication, the complete schema, polling, and error handling.







