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

# DeepSeek V4 Pro

> 通过 Anyfast OpenAI 兼容接口调用 DeepSeek V4 Pro，快速、强大且易于集成。

DeepSeek V4 Pro 通过 Anyfast 以 OpenAI 兼容接口提供服务。支持思考模式、函数调用和 JSON 模式。

## 核心能力

* **OpenAI 兼容** — 可直接替换 OpenAI SDK，无需修改其他代码
* **思考模式** — 支持可配置推理强度的深度思考
* **函数调用** — 原生支持工具和函数调用
* **JSON 模式** — 通过 `response_format` 实现结构化输出
* **长上下文** — 支持大文档处理和多轮对话
* **流式输出** — 通过 SSE 实现实时 Token 流式传输
* **提示缓存** — 自动缓存，返回命中/未命中统计

## 快速示例

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "deepseek-v4-pro",
      "messages": [
        { "role": "user", "content": "用简单的语言解释量子纠缠。" }
      ]
    }'
  ```

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

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

  response = client.chat.completions.create(
      model="deepseek-v4-pro",
      messages=[
          {"role": "user", "content": "用简单的语言解释量子纠缠。"}
      ]
  )

  print(response.choices[0].message.content)
  ```

  ```python 流式输出 theme={null}
  from openai import OpenAI

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

  stream = client.chat.completions.create(
      model="deepseek-v4-pro",
      messages=[
          {"role": "user", "content": "写一首关于大海的短诗。"}
      ],
      stream=True
  )

  for chunk in stream:
      print(chunk.choices[0].delta.content or "", end="")
  ```
</CodeGroup>

## 参数说明

| 参数                | 类型              | 必填 | 说明                                                                                                       |
| ----------------- | --------------- | -- | -------------------------------------------------------------------------------------------------------- |
| `model`           | string          | 是  | 固定为 `deepseek-v4-pro`                                                                                    |
| `messages`        | array           | 是  | `{ role, content }` 对象数组，支持 `system`、`user`、`assistant`、`tool` 角色                                        |
| `thinking`        | object          | 否  | 启用/禁用思考：`{"type": "enabled"}` 或 `{"type": "disabled"}`。可选 `reasoning_effort`：`high`、`max`、`low`、`medium` |
| `max_tokens`      | integer         | 否  | 最大生成 Token 数                                                                                             |
| `temperature`     | float           | 否  | `0`–`2`，控制随机性，默认 `1`                                                                                     |
| `stream`          | boolean         | 否  | 开启 SSE 流式传输，默认 `false`                                                                                   |
| `stream_options`  | object          | 否  | `{"include_usage": true}` 在流式结束时返回用量统计                                                                   |
| `top_p`           | float           | 否  | 核采样阈值，默认 `1`                                                                                             |
| `stop`            | string / array  | 否  | 触发停止生成的序列（最多 16 个）                                                                                       |
| `response_format` | object          | 否  | `{"type": "json_object"}` 启用 JSON 模式                                                                     |
| `tools`           | array           | 否  | 函数调用工具列表                                                                                                 |
| `tool_choice`     | string / object | 否  | 工具选择控制：`none`、`auto`、`required` 或指定函数                                                                    |
| `user_id`         | string          | 否  | 自定义用户 ID，用于内容安全处理和 KVCache 缓存隔离                                                                          |

<Card title="API 参考" icon="code" href="/zh/api-reference/model-api/deepseek/deepseek-v4-pro">
  查看 DeepSeek V4 Pro 的交互式 API Playground。
</Card>

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