NezhaGateNezhaGate
deepseek-v4.1-flash

DeepSeek V4.1 Flash · API

POST https://nezhagate.com/v1/chat/completions

OpenAI 兼容的对话补全接口,承载 DeepSeek V4.1 Flash —— DeepSeek 当前的 Flash 模型。默认开启思考,思考过程在 message.reasoning_content 返回;传 thinking={"type":"disabled"} 可关闭。思考 token 按输出价计入 usage.completion_tokens。支持工具调用与流式输出。只需把 model 设为 deepseek-v4.1-flash;目前仅提供 /v1/chat/completions。

在 Playground 试用 →

认证

Header
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

在控制台创建 API Key 后即可调用。

请求参数

参数类型必填说明
model string 是 模型 ID,此处为 deepseek-v4.1-flash。
messages array 是 对话消息数组,每项含 role(system/user/assistant)与 content。content 可为字符串,或由 {type:text} 与 {type:image_url} 组成的数组以识别图片(多模态/Vision)。
stream boolean 否 是否以 SSE 流式返回。默认 false。
temperature number 否 采样温度,0–2,越高越随机。
max_tokens integer 否 最大生成 token 数。
web_search boolean 否 设为 true 开启联网搜索:网关会先用实时搜索补充资料、再让模型作答并附来源链接(也可在 tools 里传 {"type":"web_search"} 触发)。
thinking object 否 思考开关:{"type": "disabled"} 关闭思考、直接作答(更快、输出 token 更少);不传时默认开启思考,思考过程在 message.reasoning_content 返回。

请求示例

cURL
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Hello"}], "stream": false}'

响应示例

200 · JSON
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "deepseek-v4.1-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": "The user is greeting me, so a short friendly reply fits...",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 42,
    "total_tokens": 51,
    "completion_tokens_details": {"reasoning_tokens": 31}
  }
}

图片识别(Vision)

在 messages 的 content 数组里传入图片,即可让模型识别图片内容(看图问答、读图中文字/OCR 等)。image_url 支持公网图片链接,或 base64 内联(data:image/png;base64,...)。多模态模型可用(gpt-5.5、gemini 系列等)。

curl · 图片识别(Vision)
curl https://nezhagate.com/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/photo.jpg"}}]}]}'

错误码

错误体统一为 error.message / error.type / error.code / error.param;请按 code 分支,完整清单见接入指南。

HTTPcode说明
401invalid_api_keyAPI Key 缺失或无效
402insufficient_quota余额不足或 Key 超出限额
400invalid_request模型或参数不支持
429rate_limit_exceeded上游限流
502upstream_error所有上游线路失败