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 リファレンス
Qwen3.8-Max Chat Completions API リファレンスとライブプレイグラウンド: reasoning_effort の段階、streaming、関数呼び出し、画像/動画入力に対応した 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": "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 を入れてください。例にはすでに reasoning_effort: "none" が含まれています。送信してレスポンスを確認してください。xhigh、課金は output として扱われます)。この例では、デバッグを高速かつ低コストに保つために推論を無効化しています。難しい推論を行う場合は、reasoning_effort フィールドを削除し、max_tokens を 4000+ に上げてください。詳しい解説は、Qwen3.8-Max の概要 をご覧ください。パラメータ クイックリファレンス
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | ✓ | 常に qwen3.8-max |
messages | array | ✓ | 標準の OpenAI メッセージ配列; content はマルチモーダル配列にできます (image_url / video_url は data URL を受け付けます) |
max_tokens | int | 表示される回答の出力バジェット。範囲 [1, 131072]。推論用 token には制限されません | |
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 calling のツール一覧、動作確認済み | |
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 | 停止シーケンス、動作確認済み |
3つのよくあるミス
max_tokens では推論の上限は設定されません。 max_tokens=1 を設定しましたが、それでも出力 token が 1,054 個課金されました(うち 1,045 個は推論です)。コストを抑えるには reasoning_effort="none" を使用してください。2. 強制的なツール呼び出しには推論をオフにする必要があります。 tool_choice を "required" または名前付き関数に設定すると、推論モードは 400 を返すか、何も言わずに呼び出しをスキップします。これと併せて reasoning_effort="none" を指定してください。3. thinking_budget には効果がありません。 どの値でも low ティアと同じように扱われます。代わりに reasoning_effort を使用してください。レスポンスの読み方
- thinking トレースは
choices[0].message.reasoning_contentにあります(thinking がオンのときに返されます) - thinking コストは
usage.completion_tokens_details.reasoning_tokensにあり、キャッシュヒットはusage.prompt_tokens_details.cached_tokensです - 一部の上流ルートはこの 2 つのフィールドを報告しません(テストではリクエストのおよそ 3 分の 1) — 正確な thinking コストの集計が必要な場合は、この点に留意してください
- 7 つの有効な
reasoning_effort値は、実際には 4 つのティアに対応します。maxはxhighより深く推論しません - 不正な
reasoning_effort値を指定すると、黙ってダウングレードされるのではなく、有効な全セットを列挙した 400 が返されます
関連
- Qwen3.8-Max 概要 — 機能比較表、料金、ベストプラクティスの完全版
- Qwen3.6 シリーズ(旧版) — 直前の5モデル
承認
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
このページは役に立ちましたか?