跳转到主要内容
POST
/
v1
/
chat
/
completions
对话补全
curl --request POST \
  --url https://www.anyfast.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "deepseek-v4-flash",
  "messages": [
    {
      "role": "user",
      "content": "你好!"
    }
  ],
  "thinking": {},
  "max_tokens": 2,
  "response_format": {
    "type": "text"
  },
  "stop": "<string>",
  "stream": false,
  "stream_options": {
    "include_usage": true
  },
  "temperature": 1,
  "top_p": 1,
  "tools": [
    {}
  ],
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "user_id": "<string>"
}
'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 123,
  "model": "deepseek-v4-flash",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "你好!有什么我可以帮助你的吗?",
        "reasoning_content": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ]
      },
      "matched_stop": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "audio_tokens": 123,
      "text_tokens": 123
    },
    "completion_tokens_details": {
      "reasoning_tokens": 123,
      "accepted_prediction_tokens": 123,
      "rejected_prediction_tokens": 123
    }
  },
  "system_fingerprint": "<string>"
}

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.

授权

Authorization
string
header
必填

使用 Bearer 令牌进行身份验证。在 Anyfast 控制台创建 API Key 后,以 Bearer YOUR_API_KEY 格式传入 Authorization 请求头。

请求体

application/json
model
enum<string>
必填

模型 ID

可用选项:
deepseek-v4-flash
示例:

"deepseek-v4-flash"

messages
object[]
必填

对话消息列表。

Minimum array length: 1
示例:
[{ "role": "user", "content": "你好!" }]
thinking
object

启用或禁用思考模式。

max_tokens
integer

最大生成 Token 数。

必填范围: x >= 1
response_format
object

设为 {"type": "json_object"} 启用 JSON 模式。

stop

触发停止生成的序列,最多 16 个。

stream
boolean
默认值:false

为 true 时通过 SSE 流式返回结果。

stream_options
object

流式选项,仅当 stream 为 true 时有效。

temperature
number
默认值:1

采样温度,值越高输出越随机。

必填范围: 0 <= x <= 2
示例:

1

top_p
number
默认值:1

核采样阈值。

必填范围: 0 <= x <= 1
tools
object[]

模型可调用的工具列表,当前仅支持函数调用。

tool_choice

控制工具调用行为:noneautorequired 或指定函数。

可用选项:
none,
auto,
required
frequency_penalty
number
默认值:0

DeepSeek 已弃用,传入无效。

必填范围: -2 <= x <= 2
presence_penalty
number
默认值:0

DeepSeek 已弃用,传入无效。

必填范围: -2 <= x <= 2
user_id
string

自定义用户 ID,用于内容安全处理和 KVCache 缓存隔离。

Maximum string length: 512
Pattern: ^[a-zA-Z0-9\-_]+$

响应

成功生成响应

id
string
示例:

"chatcmpl-abc123"

object
string
示例:

"chat.completion"

created
integer

Unix 时间戳

model
string
示例:

"deepseek-v4-flash"

choices
object[]
usage
object
system_fingerprint
string | null

后端配置指纹。