跳转至
  • 输入模态:Image / Text / Video

  • 输出模态:Text

  • 平台能力:Function Calling、结构化输出、联网搜索、前缀续写、上下文缓存、混合思考

一、OpenAI 兼容 — Chat Completions

请求协议

https

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

请求 URL

https://genaiapi.cloudsway.net/v1/chat/completions

请求 Body 参数

参数名 二级参数 三级参数 四级参数 类型 必填 描述
model - - - string Compatible 模式必填 模型名称。qwen3.7-plusqwen3.7-plus-2026-05-26
messages - - - array 对话上下文,按顺序排列。
role - - string system / user / assistant / tool
content - - string 或 array 视消息类型 纯文本为 string;含图像/视频或显式缓存为 array。
- type - string 多模态/显式缓存时是 text / image_url / video / video_url
- text - string type=text 时是 输入文本。
- image_url url string type=image_url 时是 图片 URL 或 Base64 Data URL。
- video - array type=video 时是 图片列表形式的视频。
- video_url url string type=video_url 时是 视频文件 URL 或 Base64 Data URL。
- video_url fps float 每秒抽帧数,[0.1, 10],默认 2.0
- min_pixels - integer 图像/视频帧最小像素。Qwen3.7 输入图像:默认/最小 65536视频/图像列表:默认 65536,最小 4096
- max_pixels - integer 图像/视频帧最大像素。Qwen3.7 输入图像vl_high_resolution_images=false):默认 2621440,最大 16777216视频/图像列表:默认 655360,最大 2048000
- total_pixels - integer 视频抽帧总像素上限。Qwen3.7 系列:默认/最大 819200000
- cache_control type string 显式缓存时是 type 固定 ephemeral
partial - - boolean Assistant Message。默认 false。前缀续写。qwen3.7-plus 支持
tool_calls / tool_call_id - - - Function Calling 相关字段。
stream - - - boolean 默认 false。流式输出。
stream_options include_usage - - boolean 仅 stream=true。默认 false。最后一个 chunk 返回 usage。
temperature - - - float [0, 2)默认:非思考 0.7;思考 0.6
top_p - - - float (0, 1.0]默认:非思考 0.8;思考 0.95
top_k - - - integer 默认 20
repetition_penalty - - - float 默认 1.05
presence_penalty - - - float [-2.0, 2.0]默认:非思考 1.5;思考 0.5
response_format type - - string 是(若传该对象) text / json_object。qwen3.7-plus 支持结构化输出
max_tokens - - - integer 即将废弃,请用 max_completion_tokens。
max_completion_tokens - - - integer 完整输出(思维链+回答)最大 Token。平台模型页最大输出 131072
vl_high_resolution_images - - - boolean 默认 false。Qwen3.7 系列为 true 时固定上限 16777216
enable_thinking - - - boolean 是否开启思考模式。开启后返回 reasoning_content
preserve_thinking - - - boolean 默认 false。历史 reasoning_content 拼回输入。支持 qwen3.7-plus
thinking_budget - - - integer 思考最大 Token。Qwen3.7 系列最大思维链 262144
tool_stream - - - boolean 默认 false。仅 stream=true。qwen3.7-plus 文本模态支持。
enable_code_interpreter - - - boolean 默认 false。代码解释器。
seed - - - integer 随机种子,默认 1234
stop - - - string 或 array 停止词。
tools / tool_choice / parallel_tool_calls - - - - Function Calling 相关。

请求示例(Compatible · 文本)

curl -X POST "https://genaiapi.cloudsway.net/v1/chat/completions" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.7-plus",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "你是谁?"}
    ]
  }'

请求示例(Compatible · 多模态)

curl -X POST "https://genaiapi.cloudsway.net/v1/chat/completions" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.7-plus",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "这张图片里有什么?"},
          {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
        ]
      }
    ],
    "enable_thinking": true
  }'

请求示例(Endpoint 模式)

curl -X POST "https://genaiapi.cloudsway.net/v1/ai/{endpoint}/chat/completions" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "你好"}
    ],
    "stream": false
  }'

流式请求示例

curl -X POST "https://genaiapi.cloudsway.net/v1/chat/completions" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.7-plus",
    "messages": [
      {"role": "user", "content": "请简单介绍一下人工智能"}
    ],
    "stream": true,
    "stream_options": {"include_usage": true}
  }'

二、OpenAI 兼容 — Responses API

Header

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

请求 URL

https://genaiapi.cloudsway.net/v1/responses

请求 Body 参数

参数名 二级参数 类型 必填 描述
model - string Compatible 模式必填 qwen3.7-plus / qwen3.7-plus-2026-05-26
input - string 或 array 纯文本或消息数组
role / content / type / text - array 时是 EasyInputMessage:input_text / output_text
type / image_url - user 时是 input_image,URL 或 Base64 Data URI
instructions - string 系统指令
previous_response_id - string 多轮对话上一响应 ID(有效期 7 天)
conversation - string 会话 ID,不能与 previous_response_id 同用
stream - boolean 默认 false
store - boolean 默认 true
tools type string 是(若传 tools) web_search / web_extractor / function
tool_choice - string/object 默认 auto
temperature - float [0, 2)
top_p - float (0, 1.0]
enable_thinking - boolean 思考模式,返回 reasoning 输出项
reasoning effort string none/minimal/low/medium/high/xhigh/max
max_output_tokens - integer 最大输出 Token,最小 16

请求示例

curl -X POST "https://genaiapi.cloudsway.net/v1/responses" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -H "x-dashscope-session-cache: enable" \
  -d '{
    "model": "qwen3.7-plus",
    "input": "你能做些什么?",
    "enable_thinking": true
  }'

多轮对话示例

curl -X POST "https://genaiapi.cloudsway.net/v1/responses" \
  -H "Authorization: Bearer ${your_ak}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.7-plus",
    "input": "解释 GBDT 的主要思想",
    "previous_response_id": "resp_第一轮返回的id"
  }'

三、Anthropic 兼容 — Messages API

Header

参数名 类型 描述
Content-Type string application/json
Authorization string Bearer ${your_ak}

请求 URL

https://genaiapi.cloudsway.net/v1/messages

请求 Body 参数

参数名 二级参数 三级参数 类型 必填 描述
model - - string Compatible 模式必填 qwen3.7-plus / qwen3.7-plus-2026-05-26
max_tokens - - integer 回复最大 Token,上限 131072
system - - string/array 系统提示词,可带 cache_control
messages role/content - array user / assistant / system
type=text / text - array 时是 文本内容
type=image / source url/base64/media_type/data array 时是 图片输入
type=video / source url/base64/media_type/data array 时是 视频输入
type=tool_use / tool_result - FC 时是 工具调用与结果
stream - - boolean 默认 false
temperature - - number [0, 2)
top_p - - number 核采样
top_k - - integer 候选集大小
stop_sequences - - array 停止序列
thinking type / budget_tokens - object enabled/disabled;budget_tokens 即将废弃
tools name/description/input_schema - array 是(若传 tools) Function Calling
tool_choice type / name - object auto/any/none/tool
output_config format.type / format.schema - object qwen3.7 系列严格结构化输出(json_schema)

请求示例

curl -X POST "https://genaiapi.cloudsway.net/v1/messages" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${your_ak}" \
  -d '{
    "model": "qwen3.7-plus",
    "max_tokens": 1024,
    "system": "You are a helpful assistant",
    "messages": [
      {"role": "user", "content": "你是谁?"}
    ],
    "thinking": {"type": "disabled"}
  }'

图像输入示例

curl -X POST "https://genaiapi.cloudsway.net/v1/messages" \
  -H "Content-Type: application/json" \
  -H "Authorization: ${your_ak}" \
  -d '{
    "model": "qwen3.7-plus",
    "max_tokens": 1024,
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "描述这张图片"},
        {"type": "image", "source": {"type": "url", "url": "https://example.com/a.jpg"}}
      ]
    }]
  }'