对话补全: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