Skip to content

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:

json
{ "reasoning": { "effort": "none" } }
json
{ "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:

json
{
  "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:

json
{
  "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:

json
{
  "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:

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) ​

ParameterTypeRequiredDescription
modelstringYesTarget model name. Allowed values: deepseek-v4-1-flash. Allowed values:deepseek-v4-1-flash。 示例:deepseek-v4-1-flash。
streambooleanNoWhen 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`stringarray<objectobject
instructionsstringNoSystem instructions for the model, inserted as a system message ahead of input.
reasoningobjectNoReasoning configuration for the model.
  reasoning.effortstringNoReasoning 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。
thinkingobjectNoThinking configuration. An alternative to reasoning.effort — configure either one, not both.
  thinking.typestringNoThinking behavior: enabled (default) or disabled. Default:"enabled"。 Allowed values:enabled / disabled。 示例:enabled。
toolsarray&lt;object&gt;NoOptional tools that the model may call. Only the function type is supported.
  tools[].typestringYesTool type. Fixed as function. Allowed values:function。 示例:function。
  tools[].namestringYesFunction name. Returned verbatim when the model calls it.
  tools[].descriptionstringNoWhat the function does. Helps the model decide when to call it.
  tools[].parametersobjectYesFunction parameter definition, as a JSON Schema object.
tool_choice`stringobject`No
textobjectNoOutput format configuration.
  text.formatobjectYesThe format the answer must follow.
    text.format.typestringYesFormat 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.namestringNoSchema name. Required when type is json_schema.
    text.format.descriptionstringNoOptional description of the schema, to help the model produce the expected output.
    text.format.schemaobjectNoThe JSON Schema the answer must follow. Required when type is json_schema.
    text.format.strictbooleanNoWhether to validate the answer strictly against the schema. Only applies to json_schema.

Request Example ​

bash
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"
        }
      ]
    }
  ]
}'
json
{
  "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. ​

json
"{\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 ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:Invalid request parameters。
  error.typestring否示例:invalid_request_error。
  error.paramstring否—
  error.codestring否—
json
{
  "error": {
    "message": "Invalid request parameters",
    "type": "invalid_request_error",
    "param": "",
    "code": ""
  }
}

401 — Unauthorized - Invalid or missing API key ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:Invalid or missing API key。
  error.typestring否示例:authentication_error。
  error.paramstring否—
  error.codestring否—
json
{
  "error": {
    "message": "Invalid or missing API key",
    "type": "authentication_error",
    "param": "",
    "code": ""
  }
}

429 — Rate Limited - Too many requests ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:Too many requests。
  error.typestring否示例:rate_limit_error。
  error.paramstring否—
  error.codestring否—
json
{
  "error": {
    "message": "Too many requests",
    "type": "rate_limit_error",
    "param": "",
    "code": ""
  }
}

500 — Server error. ​

ModelFold — one API for all the best AI models.