MaaS_DeepSeek
模型概览
| 项 | 值 |
|---|---|
| 模型 ID(model) | deepseek-flash |
| 上下文长度 | 1M(源站标注「1M」,精确 token 数源文档未说明) |
| 最大输出 | 最大 384K;Chat Completions 的 max_tokens 上限 393216 |
| 默认输出上限 | 非思考模式 8K;思考模式 64K;reasoning_effort=max 时 128K |
| 最大思维链 | 源文档未说明 |
| 输入模态 | Text、Image |
| 输出模态 | Text |
| 默认思考模式 | 开启(thinking.type 默认 enabled,默认 effort 为 high) |
| 思考档位 | none / low / high / max;minimal→low,medium、xhigh→high,ultra→max |
| 图像支持 | 支持,仅 user 消息;JPEG / PNG / GIF / WebP;单图最多折算 1024 tokens |
| 上下文缓存 | 支持,磁盘缓存默认开启,无需传参 |
请求协议
https
Header
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Content-Type | string | 是 | application/json;Files 上传为 multipart/form-data |
| Authorization | string | 是 | Bearer {API_KEY}( |
OpenAI Chat Completions
请求 URL
POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions
请求 Body 参数
| 参数名 | 二级参数 | 三级参数 | 四级参数 | 类型 | 必填 | 描述 |
|---|---|---|---|---|---|---|
| model | - | - | - | string | 是 | 固定为 MaaS_Deepseek_V4.1_Flash_20260910(厂商原始 model:deepseek-flash;源站可选 deepseek-flash、deepseek-v4-pro) |
| messages | - | - | - | array[json] | 是 | 对话消息列表,至少 1 条 |
| role | - | - | string | 是 | system / user / assistant / tool |
|
| content | - | - | string 或 array | 是 | system、tool 为字符串;user 消息可为内容块数组以传图 |
|
| type | - | string | 是 | 内容块类型:text / image_url / file |
||
| text | - | string | 条件 | type=text 时的文本内容 |
||
| image_url | - | object | 条件 | type=image_url 时使用 |
||
| url | string | 是 | http(s) 外链(最长 8192 字符)或 base64 data URL |
|||
| detail | string | 否 | low(降采样至 512×512)/ high / original / auto;high 与 original 等价 |
|||
| file_id | - | string | 条件 | type=file 时用 Files API 返回的 ID(形如 file-api-...) |
||
| file_data | - | string | 条件 | type=file 时内联 base64 data URL,与 file_id 互斥 |
||
| filename | - | string | 否 | 使用 file_data 时可设置;不允许与 file_id 同用 |
||
| name | - | - | string | 否 | 参与者可选名称,用于区分同角色参与者 | |
| tool_call_id | - | - | string | 条件 | role=tool 时必填,回传对应的工具调用 ID |
|
| reasoning_content | - | - | string | 条件 | 思考模式下上一轮思维链;请求带 tools 时必须完整回传,否则返回 400 |
|
| prefix | - | - | boolean | 否 | 前缀续写开关(Beta,见「Chat Prefix Completion」) | |
| thinking | - | - | - | object | 否 | 思考模式开关:{"type":"enabled"\|"disabled"},默认 enabled |
| reasoning_effort | - | - | - | string | 否 | none / low / high / max,默认 high;none 关闭思考 |
| max_tokens | - | - | - | integer | 否 | 取值 1\~393216;未设置时非思考 8K、思考 64K、effort=max 时 128K |
| response_format | - | - | - | object | 否 | {"type":"json_object"} 启用 JSON 输出;默认 {"type":"text"} |
| stop | - | - | - | string 或 array | 否 | 最多 16 个停止序列 |
| stream | - | - | - | boolean | 否 | 开启 SSE 流式,以 data: [DONE] 结束 |
| stream_options | - | - | - | object | 否 | 必须与 stream: true 同用,否则返回 400 |
| include_usage | - | - | boolean | 否 | 为 true 时每个 chunk 都带 usage(仅末个非空);末个 chunk 无论如何都携带全量 usage |
|
| temperature | - | - | - | number | 否 | 0\~2,默认 1;思考模式下无效(不报错) |
| top_p | - | - | - | number | 否 | 0\~1,默认 1;思考模式下低于 0.95 会被抬到 0.95;非思考模式固定 1.0,传入值被忽略 |
| tools | - | - | - | array | 否 | 工具列表,仅支持 function;工具名需唯一 |
| type | - | - | string | 是 | 固定 function |
|
| function | - | - | object | 是 | 函数定义 | |
| name | - | string | 是 | 仅 a-z A-Z 0-9 _ -,最长 128 字符 |
||
| description | - | string | 否 | 供模型判断何时调用 | ||
| parameters | - | object | 否 | JSON Schema;省略表示无参数 | ||
| strict | - | boolean | 否 | 默认 false;严格模式 Beta,需 /beta base_url,且要求所有 object 的 additionalProperties=false 并全字段 required |
||
| tool_choice | - | - | - | string 或 object | 否 | none / auto / required,或 {"type":"function","function":{"name":"..."}};无 tools 时默认 none,有 tools 时默认 auto;required 与指定工具在思考模式下返回 400 |
| logprobs | - | - | - | boolean | 否 | 是否返回输出 token 的对数概率 |
| top_logprobs | - | - | - | integer | 否 | 0\~20,需同时 logprobs=true |
| user_id | - | - | - | string | 否 | 字符集 [a-zA-Z0-9\-_],最长 512;用于内容安全、KVCache 隔离与调度隔离 |
| frequency_penalty | - | - | - | number | 否 | 已废弃,传入不生效 |
| presence_penalty | - | - | - | number | 否 | 已废弃,传入不生效 |
请求示例
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"thinking": {"type": "enabled"},
"reasoning_effort": "high",
"stream": false
}'
响应示例
{
"id": "chatcmpl-xxxxxxxxxxxxxxxx",
"object": "chat.completion",
"created": 1700000000,
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"system_fingerprint": "xxxxxxxx",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?",
"reasoning_content": null,
"tool_calls": null
},
"logprobs": null
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 10,
"total_tokens": 22,
"prompt_tokens_details": {
"cached_tokens": 0,
"prompt_cache_hit_tokens": 0,
"prompt_cache_miss_tokens": 12
},
"completion_tokens_details": {
"reasoning_tokens": 0
}
}
}
finish_reason 可能取值:stop / length / content_filter / tool_calls / insufficient_system_resource / aborted。思考模式下思维链在 message.reasoning_content,与 content 同级。
流式请求示例
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true,
"stream_options": {"include_usage": true}
}'
```plain text data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}],"usage":null}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":6,"completion_tokens":2,"total_tokens":8,"prompt_tokens_details":{"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":6}}}
data: [DONE]
### SDK 调用方式
```python
from openai import OpenAI
client = OpenAI(
api_key="{API_KEY}",
base_url="https://genaiapi.cloudsway.net/v1/ai/{endpointPath}",
)
response = client.chat.completions.create(
model="MaaS_Deepseek_V4.1_Flash_20260910",
messages=[{"role": "user", "content": "Hello!"}],
reasoning_effort="high",
extra_body={"thinking": {"type": "enabled"}},
)
print(response.choices[0].message.content)
说明:用 OpenAI SDK 传 thinking 需放进 extra_body;reasoning_effort 为顶层参数
OpenAI Responses
请求 URL
POST https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses
请求 Body 参数
| 参数名 | 二级参数 | 三级参数 | 类型 | 必填 | 描述 |
|---|---|---|---|---|---|
| model | - | - | string | 是 | 固定为 MaaS_Deepseek_V4.1_Flash_20260910(厂商原始 model:deepseek-flash) |
| input | - | - | string 或 array | 条件 | 纯字符串按单条 user 消息处理,或输入项数组;与 instructions 至少填一个 |
| type | - |
string | 否 | 输入项类型:message / function_call / function_call_output / custom_tool_call / custom_tool_call_output / reasoning;其他类型被忽略 |
|
| role | - | string | 否 | message 项的角色:user / assistant / system / developer(developer 视同 user) |
|
| content | - | string 或 array | 否 | 内容字符串或内容块数组 | |
| type | string | 是 | input_text / output_text / input_image |
||
| text | string | 条件 | 文本内容块 | ||
| image_url | string | 条件 | input_image 的 http(s) 链接或 base64 data URL,与 file_id 互斥 |
||
| file_id | string | 条件 | input_image 引用 Files API 图片;file_id 存在时 detail 被忽略 |
||
| detail | string | 否 | low / high / original / auto;low 降采样至 512×512 |
||
| output | - | string 或 array | 否 | function_call_output / custom_tool_call_output 的输出,可为内容块数组(支持 input_image) |
|
| instructions | - | - | string | 否 | 系统级指令,作为首条 system 消息插入 |
| reasoning | - | - | object | 否 | 思考模式配置 |
| effort | - | string | 否 | none / low / high / max;none 关闭思考;minimal→low,medium、xhigh→high;未设置时用模型默认(开启) |
|
| summary | - | string | 否 | 源站接受该字段但不生成摘要 | |
| max_output_tokens | - | - | integer | 否 | 输出上限,含可见输出与推理 token |
| stream | - | - | boolean | 否 | 语义化 SSE,终止事件为 response.completed / response.incomplete / response.failed,无 data: [DONE] |
| temperature | - | - | number | 否 | 0\~2,默认 1;思考模式下无效 |
| top_p | - | - | number | 否 | 0\~1,默认 1;思考模式下下限 0.95,非思考模式固定 1.0 |
| text | - | - | object | 否 | 文本输出配置 |
| format | - | object | 否 | {"type":"text"}(默认)/ {"type":"json_object"} / {"type":"json_schema"} |
|
| type | string | 否 | text / json_object / json_schema |
||
| name | string | 条件 | type=json_schema 时必填 |
||
| schema | object | 条件 | type=json_schema 时必填,输出需符合该 JSON Schema |
||
| verbosity | - | string | 否 | 源站接受该字段但不生效 | |
| tools | - | - | array | 否 | 仅 function 生效;custom 仅支持 {"type":"custom","name":"apply_patch"};内置工具(web_search、file_search、code_interpreter 等)被忽略 |
| type | - | string | 是 | function |
|
| name | - | string | 是 | 非空、≤128 字符、匹配 ^[a-zA-Z0-9_-]+$、全局唯一 |
|
| description | - | string | 否 | 供模型判断何时调用 | |
| parameters | - | object | 否 | JSON Schema;省略表示无参数 | |
| tool_choice | - | - | string 或 object | 否 | none / auto(默认)/ required,或 {"type":"function","name":"..."} |
| top_logprobs | - | - | integer | 否 | 0\~20 |
| user | - | - | string | 否 | 字符集 [a-zA-Z0-9\-_],最长 512;同时用于安全审核、KVCache 与调度隔离 |
| parallel_tool_calls | - | - | boolean | 否 | 被忽略(并行工具调用始终开启) |
| max_tool_calls | - | - | integer | 否 | 被忽略 |
| previous_response_id | - | - | string | 否 | 不支持(接口无状态) |
| conversation | - | - | - | 否 | 不支持 |
| store | - | - | - | 否 | 不支持,响应恒为 store: false |
| background | - | - | - | 否 | 不支持 |
| metadata | - | - | - | 否 | 不支持 |
| include | - | - | - | 否 | 不支持 |
| prompt | - | - | - | 否 | 不支持 |
| truncation | - | - | - | 否 | 不支持,超上下文返回 400 |
| service_tier | - | - | - | 否 | 不支持 |
| safety_identifier | - | - | - | 否 | 不支持 |
| prompt_cache_key / prompt_cache_retention | - | - | - | 否 | 不支持,缓存自动管理 |
| context_management | - | - | - | 否 | 不支持 |
| stream_options | - | - | - | 否 | 不支持 |
不支持的参数被静默忽略、不报错。文件输入(file 类型)不支持;图片仅允许出现在 user / developer 消息及 function_call_output / custom_tool_call_output 的 output 中,出现在 system / assistant 返回 400。
请求示例
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"instructions": "You are a helpful assistant.",
"input": "Hi, how are you?",
"reasoning": {"effort": "high"}
}'
响应示例
{
"id": "resp-xxxxxxxxxxxxxxxx",
"object": "response",
"created_at": 1700000000,
"status": "completed",
"error": null,
"incomplete_details": null,
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"output": [
{
"type": "reasoning",
"id": "rs-xxx",
"status": "completed",
"content": [{"type": "reasoning_text", "text": "..."}]
},
{
"type": "message",
"id": "msg-xxx",
"status": "completed",
"role": "assistant",
"content": [{"type": "output_text", "text": "I am doing well, thanks!"}]
}
],
"usage": {
"input_tokens": 12,
"input_tokens_details": {"cached_tokens": 0},
"output_tokens": 20,
"output_tokens_details": {"reasoning_tokens": 8},
"total_tokens": 32
}
}
status 取值:in_progress / completed / incomplete / failed;incomplete_details.reason 取值:max_output_tokens / content_filter。
流式请求示例
curl -X POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/responses' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"input": "Hi, how are you?",
"stream": true
}'
(事件流:response.created → response.in_progress → response.output_item.added/done → response.content_part.added/done → response.reasoning_text.delta/done → response.output_text.delta/done → response.function_call_arguments.delta/done → response.custom_tool_call_input.delta/done → 终止于 response.completed / response.incomplete / response.failed,每个事件带 sequence_number)
SDK 调用方式
from openai import OpenAI
client = OpenAI(
api_key="{API_KEY}",
base_url="https://genaiapi.cloudsway.net/v1/ai/{endpoint}",
)
response = client.responses.create(
model="MaaS_Deepseek_V4.1_Flash_20260910",
instructions="You are a helpful assistant.",
input="Hi, how are you?",
reasoning={"effort": "high"},
)
print(response.output_text)
Anthropic Messages
请求 URL
POST https://genaiapi.cloudsway.net/{endpoint}/v1/messages
Header(本协议额外)
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| x-api-key | string | 是 | 源站标注 Fully Supported(Anthropic 协议鉴权头) |
| anthropic-version | string | 否 | 源站忽略,传了不生效 |
| anthropic-beta | string | 条件 | /messages 上被忽略;Files 的 Anthropic 兼容端点必需 files-api-2025-04-14 |
请求 Body 参数
| 参数名 | 二级参数 | 三级参数 | 四级参数 | 类型 | 必填 | 描述 |
|---|---|---|---|---|---|---|
| model | - | - | - | string | 是 | 固定为 MaaS_Deepseek_V4.1_Flash_20260910(厂商原始 model:deepseek-flash) |
| max_tokens | - | - | - | integer | 是 | 源站标注 Fully Supported;本协议下为必填 |
| messages | - | - | - | array[json] | 是 | Anthropic 消息格式,与 Chat Completions 的 messages 结构不同 |
| role | - | - | string | 是 | user / assistant |
|
| content | - | - | string 或 array | 是 | 字符串或内容块数组 | |
| type | - | string | 是 | text / image / thinking / tool_use / tool_result / server_tool_use / web_search_tool_result 受支持;document、search_result、redacted_thinking、code_execution_tool_result、mcp_tool_use、mcp_tool_result、container_upload 不支持 |
||
| text | - | string | 条件 | type=text 时文本(cache_control、citations 被忽略) |
||
| source | - | object | 条件 | type=image 时的图片来源 |
||
| type | string | 是 | base64 / url / file |
|||
| media_type | string | 条件 | base64 时必填:image/jpeg / image/png / image/gif / image/webp |
|||
| data | string | 条件 | base64 时的图片数据 |
|||
| url | string | 条件 | url 时的外链,最长 8192 字符 |
|||
| file_id | string | 条件 | file 时引用 Files API 图片,需带 anthropic-beta: files-api-2025-04-14 |
|||
| id / name / input / tool_use_id / content / is_error | - | - | 条件 | tool_use、tool_result 字段:id、input、name、tool_use_id、content 受支持;cache_control、is_error 被忽略 |
||
| system | - | - | - | string | 否 | 源站标注 Fully Supported |
| stream | - | - | - | boolean | 否 | 源站标注 Fully Supported(事件列表源文档未说明) |
| stop_sequences | - | - | - | array | 否 | 源站标注 Fully Supported |
| temperature | - | - | - | number | 否 | 源站标注 Fully Supported,范围 [0.0 \~ 2.0] |
| top_p | - | - | - | number | 否 | 仅思考模式生效,下限 0.95;非思考模式固定 1.0 |
| top_k | - | - | - | integer | 否 | 源站忽略 |
| thinking | - | - | - | object | 否 | 支持;budget_tokens 被忽略 |
| output_config | - | - | - | object | 否 | 仅 effort 受支持 |
| effort | - | - | string | 否 | low / high / max(Anthropic 协议下的思考档位字段名) |
|
| metadata | - | - | - | object | 否 | 仅 user_id 受支持,其余忽略 |
| user_id | - | - | string | 否 | 用于安全审核、KVCache 与调度隔离 | |
| tools | - | - | - | array | 否 | 工具定义 |
| name | - | - | string | 是 | 源站标注 Fully Supported | |
| input_schema | - | - | object | 是 | 源站标注 Fully Supported | |
| description | - | - | string | 否 | 源站标注 Fully Supported | |
| cache_control | - | - | - | 否 | 被忽略 | |
| tool_choice | - | - | - | object | 否 | none 支持;auto / any / tool 支持(disable_parallel_tool_use 被忽略) |
| container | - | - | - | - | 否 | 被忽略 |
| mcp_servers | - | - | - | - | 否 | 被忽略 |
| service_tier | - | - | - | - | 否 | 被忽略 |
备注:源站对 Claude 模型名做映射——claude-opus* → deepseek-v4-pro,claude-haiku*、claude-sonnet* → deepseek-flash;传入无法识别的模型名会自动落到底层 Flash 模型。MaaS 侧是否沿用该映射以平台配置为准。本协议支持在对话中间插入工具调用消息与 system 消息(Chat Completions 协议不支持插入工具调用)。
请求示例
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"max_tokens": 1000,
"system": "You are a helpful assistant.",
"messages": [
{"role": "user", "content": [{"type": "text", "text": "Hi, how are you?"}]}
],
"output_config": {"effort": "high"}
}'
响应示例
{
"id": "msg_xxxxxxxxxxxxxxxx",
"type": "message",
"role": "assistant",
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"content": [
{"type": "text", "text": "I am doing well, thanks!"}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {"input_tokens": 12, "output_tokens": 20}
}
(content 与 usage 的具体字段名以 MaaS 端点返回为准;源站兼容性表仅给出字段支持状态,未给出响应完整字段清单)
流式请求示例
curl -X POST 'https://genaiapi.cloudsway.net/{endpoint}/v1/messages' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-d '{
"model": "MaaS_Deepseek_V4.1_Flash_20260910", //当使用endpoint调用时,endpoint将锁定model,更换model参数变量不生效
"max_tokens": 1000,
"messages": [{"role": "user", "content": "Hi, how are you?"}],
"stream": true
}'
(源站标注 stream Fully Supported,但未公布事件类型清单——「源文档未说明」)
SDK 调用方式
import anthropic
client = anthropic.Anthropic(
api_key="{API_KEY}",
base_url="https://genaiapi.cloudsway.net/{endpoint}/v1",
)
message = client.messages.create(
model="MaaS_Deepseek_V4.1_Flash_20260910",
max_tokens=1000,
system="You are a helpful assistant.",
messages=[
{"role": "user", "content": [{"type": "text", "text": "Hi, how are you?"}]}
],
)
print(message.content)