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

# DeepSeek V4 Pro

> DeepSeek 旗舰 V4 —— 开源权重档最强代码生成，支持 reasoning chain。

**厂商：** DeepSeek
**Model ID：** `deepseek-v4-pro`
**能力：** 64K context · tool use · streaming · structured output · reasoning
**价格：** 按 token，pro 档（[实时价格](https://bytespike.ai/pricing#text)）

DeepSeek V4 Pro 是开源权重档中代码生成任务的标杆。当问题结构化 ——
明确定义算法的实现、约束清晰的重构、代码库风格的迁移 —— 而且答案
要么能编要么不能时，伸手抓它。对更自由的任务（架构设计、散文、多
步规划），GPT-5.5 和 Claude Opus 4.8 仍有优势。

## 请求

```bash theme={null}
curl https://llm.bytespike.ai/v1/chat/completions \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [{"role": "user", "content": "Implement a thread-safe LRU cache in Rust."}]
  }'
```

### Body 参数

| 字段                | 类型      | 是否必填 | 默认        | 说明                                              |
| ----------------- | ------- | ---- | --------- | ----------------------------------------------- |
| `model`           | string  | 是    | —         | `deepseek-v4-pro`                               |
| `messages`        | array   | 是    | —         | —                                               |
| `max_tokens`      | integer | 否    | model max | 最大：16384。                                       |
| `temperature`     | number  | 否    | 1.0       | —                                               |
| `tools`           | array   | 否    | —         | 支持 function calling（并行）。                        |
| `response_format` | object  | 否    | —         | JSON / 结构化输出。                                   |
| `reasoning`       | object  | 否    | —         | 可选 reasoning chain —— 设 `{"enabled": true}` 启用。 |
| `stream`          | boolean | 否    | false     | SSE 流式。                                         |

## 响应

```json theme={null}
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "deepseek-v4-pro",
  "choices": [{"index": 0, "message": {"role": "assistant", "content": "use std::sync::..."}, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 32, "completion_tokens": 1248, "total_tokens": 1280}
}
```

## 代码示例

<CodeGroup>
  ```bash cURL theme={null}
  curl https://llm.bytespike.ai/v1/chat/completions \
    -H "Authorization: Bearer $BYTESPIKE_API_KEY" \
    -H "content-type: application/json" \
    -d '{"model": "deepseek-v4-pro", "messages": [{"role": "user", "content": "Implement a thread-safe LRU cache in Rust."}]}'
  ```

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

  client = OpenAI(base_url="https://llm.bytespike.ai/v1", api_key="$BYTESPIKE_API_KEY")
  resp = client.chat.completions.create(
      model="deepseek-v4-pro",
      messages=[{"role": "user", "content": "Implement a thread-safe LRU cache in Rust."}],
  )
  print(resp.choices[0].message.content)
  ```

  ```javascript Node theme={null}
  import OpenAI from "openai"

  const client = new OpenAI({
    baseURL: "https://llm.bytespike.ai/v1",
    apiKey: process.env.BYTESPIKE_API_KEY,
  })
  const resp = await client.chat.completions.create({
    model: "deepseek-v4-pro",
    messages: [
      { role: "user", content: "Implement a thread-safe LRU cache in Rust." },
    ],
  })
  console.log(resp.choices[0].message.content)
  ```
</CodeGroup>

## 流式 + 缓存

`"stream": true` 走 SSE。稳定前缀自动 prompt caching。

## 错误

| Code                        | 触发 | 是否计费    |
| --------------------------- | -- | ------- |
| 400 / 401 / 402 / 422 / 429 | 标准 | 否       |
| 5xx                         | 上游 | 否（自动重试） |

## 何时使用

* 在明确定义语言中的结构化代码生成。
* 算法实现、约束严格的重构。
* 更低延迟，见 [DeepSeek V4 Flash](/zh/api-reference/text/deepseek-v4-flash)。
* 代码以外的多步规划，见 [GPT-5.5](/zh/api-reference/text/gpt-5-5) 或 [Claude Opus 4.8](/zh/api-reference/text/claude-opus-4-8)。

## 限制

| 限制                 | 值            |
| ------------------ | ------------ |
| Context window     | 64K tokens   |
| Max output         | 16384 tokens |
| 支持 tool use        | 是（并行）        |
| 支持 vision          | 否            |
| 支持 streaming       | 是            |
| 支持 prompt caching  | 自动           |
| 支持 reasoning chain | 是            |
