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
}
}
}Qwen3.8-Max Chat API Reference
Qwen3.8-Max Chat Completions API reference and live playground: OpenAI-compatible format with reasoning_effort tiers, streaming, function calling, and image/video input.
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 in Authorization. The example already includes reasoning_effort: "none" — hit send to see the response.xhigh, billed as output). The example disables thinking to keep debugging fast and cheap; for hard reasoning, drop the reasoning_effort field and raise max_tokens to 4000+. For the full write-up, see the Qwen3.8-Max overview.Parameter quick reference
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | ✓ | Always qwen3.8-max |
messages | array | ✓ | Standard OpenAI message array; content may be a multimodal array (image_url / video_url accept data URLs) |
max_tokens | int | Output budget for the visible answer, range [1, 131072]. Does not bound thinking tokens | |
reasoning_effort | string | none / minimal / low / medium / high / xhigh / max, default xhigh | |
stream | bool | SSE streaming; this endpoint returns usage in the final chunk even without stream_options | |
response_format | object | json_schema structured output, held strictly in testing | |
tools | array | Function calling tool list, verified working | |
tool_choice | string/object | auto / none work as-is; required or a named function requires reasoning_effort: "none" | |
n | int | Values above 1 require reasoning_effort: "none" | |
temperature | number | Valid range [0.0, 2.0); passing 2 returns 400 | |
stop | array | Stop sequences, verified working |
Three easy mistakes
max_tokens does not cap thinking. We set max_tokens=1 and were still billed 1,054 output tokens (1,045 of them thinking). Use reasoning_effort="none" to control cost.2. Forced tool calls need thinking off. With tool_choice set to "required" or a named function, thinking mode returns a 400 or silently skips the call — pass reasoning_effort="none" alongside it.3. thinking_budget has no effect. Any value behaves like the low tier; use reasoning_effort instead.Reading the response
- The thinking trace is in
choices[0].message.reasoning_content(returned while thinking is on) - Thinking cost is in
usage.completion_tokens_details.reasoning_tokens; cache hits inusage.prompt_tokens_details.cached_tokens - Some upstream routes do not report those two fields (roughly one third of requests in testing) — keep this in mind if you need exact thinking-cost accounting
- The seven legal
reasoning_effortvalues map to only four real tiers;maxdoes not think harder thanxhigh - An illegal
reasoning_effortvalue returns a 400 listing the full legal set rather than silently downgrading
Related
- Qwen3.8-Max overview — full capability matrix, pricing, and best practices
- Qwen3.6 series (legacy) — the previous five models
Authorizations
Add Authorization: Bearer YOUR_API_KEY to the request header
Body
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
Was this page helpful?