对话补全:Qwen3.8-Max(OpenAI 兼容)
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'qwen3.8-max', messages: [{role: 'user', content: '用一句话介绍你自己'}]})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'qwen3.8-max',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{
"message": {
"role": "<string>",
"content": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
{}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123
},
"prompt_tokens_details": {
"cached_tokens": 123
}
}
}Qwen3 系列
Qwen3.8-Max Chat API 参考
Qwen3.8-Max Chat Completions API 参考与在线调试:OpenAI 兼容格式,支持 reasoning_effort 分档、流式、Function Call、图片与视频输入。
POST
/
v1
/
chat
/
completions
对话补全:Qwen3.8-Max(OpenAI 兼容)
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'qwen3.8-max', messages: [{role: 'user', content: '用一句话介绍你自己'}]})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'qwen3.8-max',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"qwen3.8-max\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{
"message": {
"role": "<string>",
"content": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
{}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123
},
"prompt_tokens_details": {
"cached_tokens": 123
}
}
}右侧 Playground 可直接调试:在 Authorization 填
Bearer sk-your-api-key,默认示例已带 reasoning_effort: "none",点击发送即可看到响应。模型默认开启深度思考(默认
xhigh 档,思考计入输出计费)。示例默认关闭思考是为了让调试更快更省;需要复杂推理时删掉 reasoning_effort 字段并把 max_tokens 给到 4000+。概览与完整实测数据见 Qwen3.8-Max 概览。参数说明速查
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | ✓ | 固定 qwen3.8-max |
messages | array | ✓ | OpenAI 标准消息数组;content 可为多模态数组(image_url / video_url 支持 data URL) |
max_tokens | int | 可见回答的输出配额,范围 [1, 131072]。不约束思考 tokens | |
reasoning_effort | string | none / minimal / low / medium / high / xhigh / max,默认 xhigh | |
stream | bool | SSE 流式;本端点即使不带 stream_options 也会在末块回 usage | |
response_format | object | json_schema 结构化输出,实测严格守约 | |
tools | array | Function Call 工具列表,实测可用 | |
tool_choice | string/object | auto / none 可直接用;required 或指定函数需同时设 reasoning_effort: "none" | |
n | int | 大于 1 时需同时设 reasoning_effort: "none" | |
temperature | number | 有效范围 [0.0, 2.0),传 2 即报 400 | |
stop | array | 停止序列,实测生效 |
三个容易踩的坑
1.
max_tokens 管不住思考。 实测设 max_tokens=1,仍被计 1054 个输出 token(其中 1045 个是思考)。控成本请用 reasoning_effort="none"。2. 强制工具调用要关思考。 tool_choice 设 "required" 或指定函数时,思考模式下会返回 400 或静默不调用,需同时传 reasoning_effort="none"。3. thinking_budget 不生效。 传任何数值都等同 low 档,请改用 reasoning_effort。响应要点
- 思考正文看
choices[0].message.reasoning_content(思考开启时回显) - 思考消耗看
usage.completion_tokens_details.reasoning_tokens;缓存命中看usage.prompt_tokens_details.cached_tokens - 部分上游线路不回显这两个字段(实测约占三分之一的请求),需要精确核算思考成本时请留意
reasoning_effort七个合法值实测只对应四个真实档位,传max不会比xhigh想得更多- 传入非法的
reasoning_effort会返回 400 并列出全部合法值,不会静默降级
相关文档
- Qwen3.8-Max 概览 — 完整能力矩阵、定价与最佳实践
- Qwen3.6 系列(历史版本) — 上一代五款模型
授权
在请求头中添加 Authorization: Bearer YOUR_API_KEY
请求体
application/json
固定 qwen3.8-max
OpenAI 标准消息数组
Show child attributes
Show child attributes
可见回答的输出配额,范围 [1, 131072]。注意:不约束思考 tokens
思考分档,默认 xhigh。实测只有四个真实档位:none / minimal≡low / medium / high≡xhigh≡max
可用选项:
none, minimal, low, medium, high, xhigh, max 有效范围 [0.0, 2.0),传 2 即报 400
有效范围 (0.0, 1.0]
SSE 流式输出。本端点即使不带 stream_options 也会在末块回 usage
停止序列,实测生效
结构化输出,json_schema 实测严格守约。建议同时设 reasoning_effort: none
Function Call 工具列表,实测可用
auto / none 可直接用;required 或指定函数时需同时设 reasoning_effort: none
设为 false 可限制为单个工具调用,实测生效
候选数量。大于 1 时需同时设 reasoning_effort: none
此页面对您有帮助吗?
⌘I