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": "Introduce yourself in one sentence."
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "Introduce yourself in one sentence."
}
]
}
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: 'Introduce yourself in one sentence.'}]
})
};
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' => 'Introduce yourself in one sentence.'
]
]
]),
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\": \"Introduce yourself in one sentence.\"\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\": \"Introduce yourself in one sentence.\"\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\": \"Introduce yourself in one sentence.\"\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
}
}
}Справка по Chat API Qwen3.8-Max
Справка по API Chat Completions Qwen3.8-Max и интерактивная песочница: формат, совместимый с OpenAI, с уровнями reasoning_effort, потоковой передачей, вызовом функций и входными данными изображений/видео.
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": "Introduce yourself in one sentence."
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "qwen3.8-max",
"messages": [
{
"role": "user",
"content": "Introduce yourself in one sentence."
}
]
}
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: 'Introduce yourself in one sentence.'}]
})
};
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' => 'Introduce yourself in one sentence.'
]
]
]),
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\": \"Introduce yourself in one sentence.\"\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\": \"Introduce yourself in one sentence.\"\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\": \"Introduce yourself in one sentence.\"\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
}
}
}Bearer sk-your-api-key в Authorization. В примере уже указан reasoning_effort: "none" — нажмите send, чтобы увидеть ответ.xhigh, тарифицируется как output). В примере рассуждение отключено, чтобы отладка была быстрой и дешевой; для сложного рассуждения удалите поле reasoning_effort и увеличьте max_tokens до 4000+. Полное описание см. в обзоре Qwen3.8-Max.Краткая справка по параметрам
| Параметр | Тип | Обязательно | Примечания |
|---|---|---|---|
model | string | ✓ | Всегда qwen3.8-max |
messages | array | ✓ | Стандартный массив сообщений OpenAI; content может быть мультимодальным массивом (image_url / video_url принимают data URLs) |
max_tokens | int | Бюджет вывода для видимого ответа, диапазон [1, 131072]. Не ограничивает tokens для рассуждения | |
reasoning_effort | string | none / minimal / low / medium / high / xhigh / max, по умолчанию xhigh | |
stream | bool | Потоковая передача SSE; этот эндпоинт возвращает usage в финальном фрагменте даже без stream_options | |
response_format | object | Структурированный вывод json_schema, строго проверяемый в тестировании | |
tools | array | Список инструментов для вызова функций, подтверждено, что работает | |
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 | Последовательности остановки, подтверждено, что работает |
Три распространенные ошибки
max_tokens не ограничивает рассуждение. Мы установили max_tokens=1 и все равно заплатили за 1,054 output tokens (1,045 из них — на рассуждение). Используйте reasoning_effort="none", чтобы контролировать стоимость.2. Принудительные вызовы tools требуют отключить рассуждение. Если 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 - Некоторые upstream-маршруты не сообщают эти два поля (примерно у одной трети запросов в тестировании) — учитывайте это, если вам нужен точный учет стоимости рассуждения
- Семь допустимых значений
reasoning_effortотображаются только в четыре реальных уровня;maxне рассуждает глубже, чемxhigh - Недопустимое значение
reasoning_effortвозвращает 400 со списком всех допустимых значений, а не выполняет тихое понижение уровня
Связанное
- Обзор Qwen3.8-Max — полная матрица возможностей, тарификация и лучшие практики
- Серия Qwen3.6 (устаревшая) — предыдущие пять моделей
Авторизации
Add Authorization: Bearer YOUR_API_KEY to the request header
Тело
Always qwen3.8-max
Standard OpenAI message array
Show child attributes
Show child attributes
Output budget for the visible answer, range [1, 131072]. Note: does not bound thinking tokens
Thinking tier, default xhigh. Measured to have only four real tiers: none / minimal≡low / medium / high≡xhigh≡max
none, minimal, low, medium, high, xhigh, max Valid range [0.0, 2.0); passing 2 returns 400
Valid range (0.0, 1.0]
SSE streaming. This endpoint returns usage in the final chunk even without stream_options
Stop sequences, verified working
Structured output; json_schema held strictly in testing. Pair it with reasoning_effort: none
Function calling tool list, verified working
auto / none work as-is; required or a named function requires reasoning_effort: none
Set false to limit to a single tool call, verified working
Number of candidates. Values above 1 require reasoning_effort: none
Была ли эта страница полезной?