DeepSeek V4.1 Flash
This page is generated from the upstream official OpenAPI documentation. Endpoints, parameters and examples match the official docs; brand and API domain are replaced with ModelFold.
Endpoint
POST /openai/v1/responses
Full URL: https://ai.modelfold.online/openai/v1/responses
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
WARNING
⚠️ Chat only
This model currently supports chat requests only and has not yet been adapted for agent use. Connecting it to an agent may cause request errors or unexpected results.
DeepSeek V4.1 Flash API is an OpenAI Responses–compatible endpoint that accepts a plain string or a structured input array, thinks deeply by default, and supports function calling, image understanding, and structured JSON output.
Thinking Control — Deep thinking is on by default, with seven effort levels to tune.
Multimodal Input — Supports mixed text and image inputs in a single message.
Tools & Structured Output — Custom function calling, and answers constrained to JSON.
Unified Endpoint — Uses the unified /openai/v1/responses endpoint with model set to deepseek-v4-1-flash .
Thinking
The model thinks by default. Turn it off for a faster and cheaper answer — reasoning.effort and thinking.type do the same job, so you only need one of them. ::: caution max_output_tokens, temperature and top_p are not supported on this model and have no effect. :::
Turn thinking off
These two are equivalent:
{ "reasoning": { "effort": "none" } }{ "thinking": { "type": "disabled" } }thinking.type: enabled (default) or disabled.
Effort levels
reasoning.effort accepts none, minimal, low, medium, high, xhigh and max.
none turns thinking off (same as thinking.type: "disabled"). minimal keeps thinking brief. Above that, the higher the level the more thoroughly the model thinks and the more tokens it spends.
Tools & input
Function calling
Declare the functions the model may call. Only the function type is supported:
{
"tools": [
{
"type": "function",
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
],
"tool_choice": "auto"
}tool_choice defaults to auto once tools is present. Use required to force a call, or {"type": "function", "name": "..."} to pin one specific function.
Return the execution result
The model answers with a function_call item. Run the function, then append both that item and your function_call_output to input — the two are paired through call_id:
{
"input": [
{ "role": "user", "content": "What's the weather in Beijing today?" },
{
"type": "function_call",
"call_id": "call_00_xxx",
"name": "get_current_weather",
"arguments": "{\"location\":\"Beijing\"}"
},
{
"type": "function_call_output",
"call_id": "call_00_xxx",
"output": "Sunny, 25°C"
}
]
}Image understanding
Mix input_image and input_text parts inside one message. image_url takes a publicly reachable URL or a data:image/{format};base64,{encoded} string:
{
"input": [
{
"role": "user",
"content": [
{ "type": "input_image", "image_url": "https://example.com/demo.png" },
{ "type": "input_text", "text": "What is in this image?" }
]
}
]
}JSON output
Set text.format to constrain the answer to JSON:
{ "text": { "format": { "type": "json_object" } } }Use json_schema instead to validate the answer against a schema of your own.
Error handling
Check the response body, not only the HTTP status. Errors are returned either as {"code": ..., "msg": "..."} (for example 401 invalid API key, 402 insufficient credits, 429 rate limited; the HTTP status may still be 200) or as {"error": {"type": "...", "message": "..."}}.
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Target model name. Allowed values: deepseek-v4-1-flash. Allowed values:deepseek-v4-1-flash。 示例:deepseek-v4-1-flash。 |
stream | boolean | No | When true, responses stream in real time as server-sent events. When false, the full response is returned at once after completion. Default is true. Default:true。 示例:true。 |
input | `string | array<object | object |
instructions | string | No | System instructions for the model, inserted as a system message ahead of input. |
reasoning | object | No | Reasoning configuration for the model. |
reasoning.effort | string | No | Reasoning effort level. Higher values provide more thorough reasoning but may increase latency. none turns thinking off (same as thinking.type: "disabled"). minimal keeps thinking brief. Defaults to reasoning being enabled. Allowed values:none / minimal / low / medium / high / xhigh / max。 示例:none。 |
thinking | object | No | Thinking configuration. An alternative to reasoning.effort — configure either one, not both. |
thinking.type | string | No | Thinking behavior: enabled (default) or disabled. Default:"enabled"。 Allowed values:enabled / disabled。 示例:enabled。 |
tools | array<object> | No | Optional tools that the model may call. Only the function type is supported. |
tools[].type | string | Yes | Tool type. Fixed as function. Allowed values:function。 示例:function。 |
tools[].name | string | Yes | Function name. Returned verbatim when the model calls it. |
tools[].description | string | No | What the function does. Helps the model decide when to call it. |
tools[].parameters | object | Yes | Function parameter definition, as a JSON Schema object. |
tool_choice | `string | object` | No |
text | object | No | Output format configuration. |
text.format | object | Yes | The format the answer must follow. |
text.format.type | string | Yes | Format type. text returns plain text, json_object constrains the answer to JSON, and json_schema validates it against a schema of your own. Allowed values:text / json_object / json_schema。 示例:text。 |
text.format.name | string | No | Schema name. Required when type is json_schema. |
text.format.description | string | No | Optional description of the schema, to help the model produce the expected output. |
text.format.schema | object | No | The JSON Schema the answer must follow. Required when type is json_schema. |
text.format.strict | boolean | No | Whether to validate the answer strictly against the schema. Only applies to json_schema. |
Request Example
curl -X POST "https://ai.modelfold.online/openai/v1/responses" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-1-flash",
"stream": false,
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "What is in this image?"
},
{
"type": "input_image",
"image_url": "https://example.com/demo.png"
}
]
}
]
}'{
"model": "deepseek-v4-1-flash",
"stream": false,
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "What is in this image?"
},
{
"type": "input_image",
"image_url": "https://example.com/demo.png"
}
]
}
]
}Response
200 — Request successful.
"{\n \"id\": \"resp_xxx\",\n \"object\": \"response\",\n \"created_at\": 1790128600,\n \"model\": \"deepseek-v4-1-flash\",\n \"status\": \"completed\",\n \"output\": [\n {\n \"type\": \"reasoning\",\n \"id\": \"rs_xxx\",\n \"status\": \"completed\",\n \"summary\": [\n {\n \"type\": \"summary_text\",\n \"text\": \"The user is asking what is in the image. It shows a cat sitting on a windowsill.\"\n }\n ]\n },\n {\n \"type\": \"message\",\n \"id\": \"msg_xxx\",\n \"role\": \"assistant\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"text\": \"The image shows a cat sitting on a windowsill.\",\n \"annotations\": []\n }\n ]\n }\n ],\n \"usage\": {\n \"input_tokens\": 38,\n \"input_tokens_details\": {\n \"cached_tokens\": 0\n },\n \"output_tokens\": 36,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 35\n },\n \"total_tokens\": 74\n },\n \"credits_consumed\": 0.01\n}"400 — Bad Request - Invalid request parameters
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | 否 | — |
error.message | string | 否 | 示例:Invalid request parameters。 |
error.type | string | 否 | 示例:invalid_request_error。 |
error.param | string | 否 | — |
error.code | string | 否 | — |
{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error",
"param": "",
"code": ""
}
}401 — Unauthorized - Invalid or missing API key
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | 否 | — |
error.message | string | 否 | 示例:Invalid or missing API key。 |
error.type | string | 否 | 示例:authentication_error。 |
error.param | string | 否 | — |
error.code | string | 否 | — |
{
"error": {
"message": "Invalid or missing API key",
"type": "authentication_error",
"param": "",
"code": ""
}
}429 — Rate Limited - Too many requests
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | 否 | — |
error.message | string | 否 | 示例:Too many requests。 |
error.type | string | 否 | 示例:rate_limit_error。 |
error.param | string | 否 | — |
error.code | string | 否 | — |
{
"error": {
"message": "Too many requests",
"type": "rate_limit_error",
"param": "",
"code": ""
}
}