Skip to main content
POST
qwen3.8-max Integration Guide
OpenAI SDK compatible: swap base_url and api_key. Model name is fixed qwen3.8-max.
Related APIs:

Three easy pitfalls

1. /v1/chat/completions defaults to streaming if stream is omitted

This is opposite to OpenAI’s default (omit = non-stream). Easy to miss when porting SDK code.

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 extract

Typical error text:

Confirm a tool was called

Trust usage.x_tools (billing source of truth):
Tools declared but not invoked are free — they do not appear in 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: reasoning items in output; chat stream: delta.reasoning_content
  • enable_thinking: false is ignored in stream mode; non-stream is degraded — not recommended
Output token usage with thinking is often much higher. Cap cost with 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 with cache_control:
Response distinction:
Implicit hits typically only set 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:
Read data.pricing.effective_rates (includes group discount) and data.pricing.extras.tools.

Limits

FAQ

Q: I passed tools 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?