跳转至

MaaS_DeepSeek

请求协议

https

参数名 类型 必填 描述
Content-Type string 固定为 application/json
Authorization string Bearer ${YOUR_AK}

对话补全

请求 URL

POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions

请求 Body 参数

参数名 二级参数 三级参数 四级参数 类型 必填 描述
model - - - string 使用的模型 ID。
messages - - - array[json] 对话消息列表,按从老到新的顺序填入。
role - - string 消息作者的角色,可选值为 userassistantsystem
content - - object 消息内容,可为 string 或 array[json] 类型。
content 为 string 时 - string 消息内容为普通文本。
content 为 array[json] 时 - array[json] 消息内容为文本结构。
type string 内容类型,必须为 textfile 两者中的一个。
text string 当 type 为 text 时,填写的消息文本。
file object 当 type 为 file 时,填写的文件内容。
file_id string
thinking - - - object 用于控制模型的推理行为。
reasoning_effort - - string 控制模型的推理强度,可选值为 highmax
max_tokens - - - integer 限制模型生成的最大 token 数。
response_format - - - object 用于指定模型输出的格式。
stop - - - object 用于定义停止序列。
stream - - - boolean 是否使用流式接口,默认值为 false。若设为 true,模型将以 SSE 形式发送消息增量。
stream_options - - - object 流式传输时的附加选项。
temperature - - - number 采样温度,介于 0 到 2 之间,默认值为 1。通常建议仅调整该参数或 top_p 中的一个。
top_p - - - number 核采样参数,取值范围为 (0, 1],默认值为 1。通常建议仅调整该参数或 temperature 中的一个。
tools - - - array[json] 模型可以调用的函数列表。
tool_choice - - - object 控制模型如何调用工具。
logprobs - - - boolean 是否返回输出 token 的对数概率,默认值为 false
top_logprobs - - - integer 返回 top N 个最可能 token 的对数概率,取值范围为 0 到 20。使用时需将 logprobs 设为 true
user_id - - - string 业务侧的用户标识,字符集为 [a-zA-Z0-9\-_],最长 512 字符。
frequency_penalty - - - number (deprecated) 已弃用,该参数不再支持,传入不会产生任何效果。
presence_penalty - - - number (deprecated) 已弃用,该参数不再支持,传入不会产生任何效果。

请求示例

curl -L -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
  "messages": [
    {
      "content": "You are a helpful assistant",
      "role": "system"
    },
    {
      "content": "Hi",
      "role": "user"
    }
  ],
  "model": "MaaS_Deepseek_V4_pro_20260424",
  "thinking": {
    "type": "enabled"
  },
  "reasoning_effort": "high",
  "max_tokens": 4096,
  "response_format": {
    "type": "text"
  },
  "stop": null,
  "stream": false,
  "stream_options": null,
  "temperature": 1,
  "top_p": 1,
  "tools": null,
  "tool_choice": "none",
  "logprobs": false,
  "top_logprobs": null
}'

响应示例

{
    "id": "chatcmpl-lHhTva9flc1dlUBqu4pPADmq",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! How can I help you today?",
                "reasoning_content": "We are starting a conversation with the user. The user said \"Hi\". I should respond in a friendly and helpful manner, keeping in mind that the system prompt says \"You are a helpful assistant\". I need to introduce myself and ask how I can help. Keep it concise and warm."
            },
            "finish_reason": "stop",
            "native_finish_reason": "stop"
        }
    ],
    "created": 1780299859,
    "model": "MaaS_Deepseek_V4_pro_20260424",
    "object": "chat.completion",
    "system_fingerprint": "fp_9954b31ca7_prod0820_fp8_kvcache_20260402",
    "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 68,
        "total_tokens": 78,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "image_tokens": 0,
            "reasoning_tokens": 58,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0,
            "image_tokens": 0
        },
        "prompt_cache_hit_tokens": 0,
        "prompt_cache_miss_tokens": 10
    }
}

Anthropic API 调用

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="MaaS_Deepseek_V4_pro_20260424",
    max_tokens=1000,
    system="You are a helpful assistant.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Hi, how are you?"
                }
            ]
        }
    ]
)
print(message.content)