deepseek-v4.1-flash
Before use, press Access Basics to set
SHANHAI_BASE_URL(this site’s root address) andSHANHAI_API_KEY(this site’s token). The following command is suitable for Bash; the material example address must be replaced with a real address that can be downloaded directly.
This site also provides the name deepseek-v4.1-flash-1017; currently both point to the same version. New access can use the name of this page. If a fixed date is required, use the name with date.
Basic information
Request interface: POST /v1/chat/completions. Use this site token for authentication. For the differences between the three dialogue formats, tool round-trips and error handling, see General Description of Dialog Interface.
request parameters
| Parameter | Type | Required | Usage |
|---|---|---|---|
model |
string | is | The exact model name on this page |
messages |
array | is | Pass in complete conversations in chronological order, at least one |
messages[].role |
string | is | system Set task, user Ask a question, assistant is the historical answer, tool is the tool result |
messages[].content |
string / array / null | Depends on the message | Literal is usually a string; the tool call message can be null. The image content format is shown below. Ordinary file paths cannot be automatically uploaded as text |
messages[].tool_calls |
array | No | Keep the tool calls returned by the model as they are, and return them together with the corresponding tool results |
messages[].tool_call_id |
string | Tool result required | Same as the responded tool call id |
max_tokens |
integer | No | Limit the output length, example 1024 is not the model upper limit; the context also includes input and historical messages |
stream |
boolean | No | Default false; true Return segment by event |
stream_options.include_usage |
boolean | No | cooperates with stream:true to request the end usage; empty choices and empty usage are allowed during processing |
temperature |
number | No | Adjust the generated randomness; retain the model default value when not set, and may be fixed or ignored in thinking mode |
top_p |
number | No | Adjust the range of candidate words, usually only one with temperature |
stop |
string / array | No | Stop when encountering the specified text; do not write the end condition as a message role |
response_format |
object | No | {"type":"json_object"} Request JSON, and explicitly require JSON in the message; support is limited by the model and thinking mode |
tools |
array | No | Function tool definition; type is function, function is written with name, description, parameters |
tool_choice |
string / object | No | auto Determined by the model; none disabled; required or specified function needs model support |
parallel_tool_calls |
boolean | No | Whether parallel tool recommendations are allowed, the client should still process each call returned |
Differences between thinking and models
The default request is not to set the think switch, and the default behavior of this model is used. If you need to explicitly switch the thinking mode or adjust the thinking intensity, please contact the site customer service to confirm the fields and values supported by this model. Do not directly apply other models of thinking, enable_thinking or reasoning_effort.
When returning the thinking content, the field is choices[0].message.reasoning_content; the final answer is still content. This article does not consider the context caps, default lengths, or built-in search capabilities of other models as available configurations for this model. If you need a specific length quota, please contact the site customer service.
Request Example
curl --fail-with-body "$SHANHAI_BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"messages": [
{
"role": "user",
"content": "请用三点说明如何安排一次产品发布。"
}
],
"max_tokens": 1024,
"stream": false
}'
Continuous output
In the above example, change stream to true and add the following fields; curl also uses -N to prevent the client from caching the output.
{
"stream": true,
"stream_options": {
"include_usage": true
}
}
Return results
Read choices[0].message.content. finish_reason is stop which means it ends normally, length means it is truncated by the upper limit of the length, tool_calls means the tool needs to be executed. The prompt_tokens, completion_tokens, and total_tokens in usage represent input, output, and total processing volume respectively; Token is the unit for measuring text in the model, and is not fixed to the number of Chinese characters.
The streaming response parses the data: events one by one, splices delta.content into the answer, and saves delta.reasoning_content separately. Tool parameter fragments must be completely spliced before parsing JSON; they cannot be executed after receiving only half of the fragments. When [DONE] is received, the error will be retained when the stream is cut off, and the half-section of content will not be regarded as the complete result.
encountered a problem
If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, task number, error time and error message. Do not provide the complete token.