qwen3.8-max Integration Guide
qwen3.8-max
qwen3.8-max Integration Guide
- OpenAI-compatible: chat/completions and Responses
- Built-in tools only on Responses; thinking cannot be disabled
- Implicit/explicit context cache; PDF on chat endpoint only
- Billing = token fees + per-call tool fees
POST
qwen3.8-max Integration Guide
OpenAI SDK compatible: swap
Related APIs:
1.
This is opposite to OpenAI’s default (omit = non-stream). Easy to miss when porting SDK code.
2. Built-in tools work only on
Typical error text:
Tools declared but not invoked are free — they do not appear in
Implicit hits typically only set
Read
① Use
Declare it together with
Tool calls (especially
No. Cap with
base_url and api_key. Model name is fixed qwen3.8-max.
Three easy pitfalls
1. /v1/chat/completions defaults to streaming if stream is omitted
2. Built-in tools work only on /v1/responses
/v1/chat/completions does not support built-in tools (they are ignored with no error). For web search, code interpreter, text-to-image search, or image-to-image search, use the Responses API.
3. Wrong tool names fail silently
Invalid tool names are accepted quietly.t2i_search / i2i_search on pricing pages are not valid tool names:
Built-in tools (Responses)
Declare in/v1/responses tools as {"type": "<name>"}.
Web search
Web extract
Image search
Confirm a tool was called
Trustusage.x_tools (billing source of truth):
x_tools.
Thinking (reasoning)
Thinking cannot be turned off. Every request reasons before answering:- Thinking tokens bill as output, via
output_tokens_details.reasoning_tokens - Responses:
reasoningitems inoutput; chat stream:delta.reasoning_content enable_thinking: falseis ignored in stream mode; non-stream is degraded — not recommended
max_output_tokens.
Context cache
Reuse long prompts to cut input cost.Implicit cache (automatic)
Repeated requests with the same prefix may hit cache from the second call; hits bill at cache rates (~1/8 of normal input). Hit size is block-rounded; full hit is not guaranteed.Explicit cache
Mark content withcache_control:
Response distinction:
cached_tokens (may omit cache_type: "ephemeral").
PDF understanding
Supported only on/v1/chat/completions. Responses silently ignores PDFs (no error).
- PDFs are understood as images and bill as image input tokens (~letter ~2082 tok/page, A4 ~2147 tok/page order of magnitude); no extra parse fee
fileid://is invalid here (other-model mechanism) and treated as plain text
Billing model
Total = token fees + per-call tool fees (independent).
Fetch unit prices via the pricing API:
data.pricing.effective_rates (includes group discount) and data.pricing.extras.tools.
Limits
FAQ
Q: I passedtools but nothing ran?① Use
/v1/responses; ② correct tool names (not t2i_search); ③ check usage.x_tools — missing means not invoked and not billed.
Q: web_extractor returns 400?Declare it together with
web_search.
Q: Non-stream is slow?Tool calls (especially
image_search) take longer. Prefer streaming when timeouts matter.
Q: Can I disable thinking to save money?No. Cap with
max_output_tokens, or switch to a model that allows disabling thinking.
Q: How do I check usage?