> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.com.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek V4.1 Flash

> 通过 AnyFast OpenAI 兼容的 Chat Completions API 调用 DeepSeek V4.1 Flash。

DeepSeek V4.1 Flash 通过 AnyFast 提供服务，公开模型 ID 为 `deepseek-v4.1-flash`，调用端点为 OpenAI 兼容的 `POST /v1/chat/completions`。支持文本和图片输入、思考与非思考模式、函数调用、JSON 输出、流式输出和提示缓存。

<Info>
  DeepSeek 官方将该版本命名为 `DeepSeek-V4.1-Flash`，并在官方 API 中使用 `deepseek-flash`。调用 AnyFast 时请使用 `deepseek-v4.1-flash`。
</Info>

## 模型规格

| 项目 | 规格 |
| - | - |
| AnyFast 模型 ID | `deepseek-v4.1-flash` |
| 输入 | 文本、图片 |
| 输出 | 文本 |
| 上下文窗口 | 1,048,576 Token |
| 最大输出 | 393,216 Token |
| 思考模式 | 支持，默认开启 |
| 思考强度 | `low`、`high`、`max`；默认 `high` |
| 结构化输出 | JSON 模式 |
| 工具 | 函数调用 |
| 流式输出 | SSE |

## 快速示例

<Tabs sync={false}>
  <Tab title="文本">
    ```bash cURL theme={null}
    curl https://www.anyfast.com.cn/v1/chat/completions \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "deepseek-v4.1-flash",
        "messages": [
          {"role": "user", "content": "解释 B 树索引如何加速数据库查询。"}
        ],
        "max_tokens": 1024
      }'
    ```
  </Tab>

  <Tab title="图片理解">
    用户消息使用由文本和 `image_url` 组成的数组。图片可以使用公网 HTTP(S) URL 或 Base64 data URL。

    ```bash cURL theme={null}
    curl https://www.anyfast.com.cn/v1/chat/completions \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "deepseek-v4.1-flash",
        "messages": [{
          "role": "user",
          "content": [
            {"type": "text", "text": "描述这张图片，并识别其中的文字。"},
            {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
          ]
        }]
      }'
    ```
  </Tab>

  <Tab title="思考模式">
    `thinking` 控制是否开启思考，`reasoning_effort` 是独立的顶层字段。

    ```python Python theme={null}
    from openai import OpenAI

    client = OpenAI(
        api_key="YOUR_API_KEY",
        base_url="https://www.anyfast.com.cn/v1",
    )

    response = client.chat.completions.create(
        model="deepseek-v4.1-flash",
        messages=[
            {"role": "user", "content": "找出并解释这个算法中的错误。"}
        ],
        reasoning_effort="high",
        extra_body={"thinking": {"type": "enabled"}},
    )

    print(response.choices[0].message.reasoning_content)
    print(response.choices[0].message.content)
    ```
  </Tab>
</Tabs>

## 思考模式

思考模式默认开启，默认强度为 `high`。对于不需要推理、更加关注延迟的请求，可以使用 `{"thinking":{"type":"disabled"}}`。开启思考时，推理内容位于 `choices[0].message.reasoning_content`，最终答案位于 `choices[0].message.content`。

官方模型支持 `low`、`high`、`max` 三档思考强度。思考模式下，`temperature`、`presence_penalty` 和 `frequency_penalty` 不生效。请求包含 `tools` 时，后续工具调用轮次需要完整回传先前 assistant 消息中的 `reasoning_content`。

## 图片输入

`image_url` 内容块只能放在 `user` 消息中。上游支持 JPEG、PNG、GIF 和 WebP。URL 必须可以直接通过 HTTP(S) 下载；本地图片可以使用 Base64 data URL。图片 Token 计入 `usage.prompt_tokens`。

## 常用参数

| 参数 | 类型 | 必填 | 说明 |
| - | - | -: | - |
| `model` | string | 是 | 固定为 `deepseek-v4.1-flash`。 |
| `messages` | array | 是 | 对话消息，支持 `system`、`user`、`assistant`、`tool`。 |
| `thinking` | object | 否 | `{"type":"enabled"}` 或 `{"type":"disabled"}`，默认开启。 |
| `reasoning_effort` | string | 否 | `none` 关闭思考；`low`、`high`、`max` 选择思考强度，默认 `high`。 |
| `max_tokens` | integer | 否 | 最大生成 Token 数，范围 1–393,216。 |
| `stream` | boolean | 否 | 通过 SSE 流式返回 Chat Completions 分块。 |
| `response_format` | object | 否 | `{"type":"json_object"}` 开启 JSON 模式，同时需要在提示词中明确要求输出 JSON。 |
| `tools` | array | 否 | OpenAI 格式的函数工具。 |
| `tool_choice` | string 或 object | 否 | `none`、`auto`、`required` 或指定函数。 |
| `user_id` | string | 否 | 用于内容安全与缓存隔离的稳定终端用户标识。 |

<Card title="DeepSeek V4.1 Flash API 参考" icon="code" href="/api-reference/model-api/deepseek/deepseek-v4-1-flash">
  查看完整的 Chat Completions 请求与响应字段。
</Card>

资料来源：[DeepSeek V4.1 Flash 发布说明](https://api-docs.deepseek.com/zh-cn/news/news260910/)、[模型与价格](https://api-docs.deepseek.com/zh-cn/quick_start/pricing/)、[思考模式](https://api-docs.deepseek.com/zh-cn/guides/thinking_mode/)和[图片理解](https://api-docs.deepseek.com/zh-cn/guides/vision/)。

<script src="/feedback.js" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.