> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen4-Max Flagship Multimodal Model | APIYI

> Qwen4-Max (qwen4-max) offers native vision, tool calling, and approximately 1M context. APIYI pricing is $1.50 input, $4.50 output, and $0.075 cached input per 1M tokens, with findings from 325 test calls.

Qwen4-Max (`qwen4-max`) is the flagship model in Alibaba's Qwen4 series. Its 2.4-trillion-parameter backbone supports native text, image, and video input for complex reasoning, coding agents, long-document analysis, and professional workflows. The model is live on APIYI at the same list price as the international provider site, backed by **325 pre-release test calls** and **15 release checks in the Default group**.

> [!NOTE]
>
> **Model name: `qwen4-max`**. Available in the Default, SVIP, CodexResponses, and ClaudeCode groups, with Chat Completions, Responses, and Messages endpoints open. Thinking is enabled by default; set `reasoning_effort="none"` for everyday chat to reduce reasoning token usage.

## Why this model

> [card] Provider pricing plus top-up bonuses
>
> Input \$1.50, output \$4.50, cached input \$0.075 per 1M tokens. [Top-up bonuses](https://docs.apiyi.com/en/faq/recharge-promotions.md) of 10％–20％ provide an effective rate of roughly 83–91％ of list price.

> [card] Near-1M context verified
>
> A request with 951,498 input tokens recalled markers from both the middle and end in 92.3 seconds. The reported input ceiling is 991,808 tokens.

> [card] Native multimodal input
>
> Text, image, and video input were all tested. Image OCR and two-image identification passed across all three provider endpoints; Chat video understanding described the test footage correctly.

> [card] Complete agent tool loop
>
> Single, parallel, forced, named, and streaming tool calls passed, along with full two-round tool-result replay.

## Endpoints and groups

| Endpoint | Availability and recommended group |
| - | - |
| `/v1/chat/completions` | Open; Default and SVIP recommended for general use |
| `/v1/responses` | Open; CodexResponses recommended for Codex / Responses clients |
| `/v1/messages` | Open; ClaudeCode recommended for Claude Code clients |
| Groups | Default, SVIP, CodexResponses, ClaudeCode |
| Billing | Pay-as-you-go - Chat |

All three endpoints are open. These are client-specific group recommendations, not restrictions on other groups. Minimal Responses and Messages requests also passed with a Default-group token; the groups available to each token are governed by its console configuration.

## Pricing

Per 1M tokens, before top-up bonuses:

| Item | APIYI | International provider site |
| - | -: | -: |
| Input | **\$1.50** | \$1.50 |
| Output, including reasoning | **\$4.50** | \$4.50 |
| Cached input | **\$0.075** | \$0.075 |

Prices match the international Qwen4-Max provider site and may change. Check [Model pricing](https://docs.apiyi.com/en/models/index.md) for the current rate. Top-up bonuses provide an effective rate of roughly 83–91％ of list price; see [Top-up promotions](https://docs.apiyi.com/en/faq/recharge-promotions.md).

## Specifications and measurements

| Item | Specification or measurement |
| - | - |
| Model ID | `qwen4-max` |
| Architecture | Qwen4 sparse MoE; 2.4T backbone parameters, 71B activated per token, plus 328B N-gram Embedding parameters |
| Context | 1M claimed by the provider; 951,498 input tokens verified |
| Input-limit error | `Range of input length should be [1, 991808]` |
| Input modalities | Text, image, video |
| Thinking | Enabled by default; disable with `none` / `off` |
| Chat non-streaming latency | P50 5.65 s, P95 8.16 s |
| Chat time to first token | P50 3.93 s |
| Chat output rate | P50 14.93 tokens/s |
| Chat concurrency | 12/12 succeeded; 10.9 s wall time |

These measurements come from the pre-release test window on 2026-11-17 (UTC+8) and are not a long-term SLA.

## Thinking and output budget

`reasoning_effort` accepts `none`, `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Invalid values return a 400 listing the accepted set.

* `none` / `off`: disable thinking for everyday chat, extraction, and high-frequency calls.
* `minimal` / `low` / `medium`: retain some reasoning; token usage may not increase monotonically on simple tasks.
* `high` / `xhigh` / `max`: produced more reasoning in testing and are better suited to complex tasks.
* `reasoning_effort` and `thinking_budget` are mutually exclusive; sending both returns 400.

```python theme={null}
resp = client.chat.completions.create(
    model="qwen4-max",
    messages=[{"role": "user", "content": "Explain load balancing in one sentence."}],
    reasoning_effort="none",
    max_tokens=500,
)
```

> [!WARNING]
>
> **On Qwen4-Max, `max_tokens` covers reasoning and visible output together.** A small budget can be consumed entirely by reasoning, producing HTTP 200 with empty content and a `length` finish reason. Use `reasoning_effort` to control cost, and leave enough `max_tokens` for the answer itself.

## Code examples

### Python (OpenAI SDK compatible)

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.apiyi.com/v1",
)

resp = client.chat.completions.create(
    model="qwen4-max",
    messages=[
        {"role": "user", "content": "Prove that among any 5 integers, some 3 sum to a multiple of 3."}
    ],
    reasoning_effort="xhigh",
    max_tokens=4000,
)

print(resp.choices[0].message.content)
```

### Image input

```python theme={null}
import base64

with open("chart.png", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

resp = client.chat.completions.create(
    model="qwen4-max",
    messages=[{"role": "user", "content": [
        {"type": "text", "text": "Read the number in this image and return only the number."},
        {"type": "image_url", "image_url": {
            "url": f"data:image/png;base64,{image_b64}"
        }},
    ]}],
    max_tokens=500,
)
```

Both base64 and remote image URLs passed provider-channel tests. For video, use a base64 data URL with `video_url`, or a frame sequence in `{"type": "video", "video": [...]}`; frame sequences require 4–80 frames.

### cURL

```bash theme={null}
curl https://api.apiyi.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen4-max",
    "messages": [{"role": "user", "content": "Hello"}],
    "reasoning_effort": "none",
    "max_tokens": 500
  }'
```

## Tool calling

Chat Completions passed pre-release tests for single and parallel tools, `parallel_tool_calls=false`, `tool_choice="required"`, named tools, disabled tools, streaming tool deltas, and full two-round tool-result replay.

```python theme={null}
resp = client.chat.completions.create(
    model="qwen4-max",
    messages=[{"role": "user", "content": "Check the weather in Beijing."}],
    tools=tools,
    tool_choice={"type": "function", "function": {"name": "get_weather"}},
    max_tokens=1000,
)
```

For multiple candidate answers, use `n > 1` together with `reasoning_effort="none"`; `n > 1` returns 400 while thinking is enabled.

## Structured output

`response_format={"type": "json_schema"}` passed tests for nested objects, arrays, enums, and `additionalProperties: false`. Streaming responses also produced valid JSON.

> [!TIP]
>
> Prefer `json_schema` with `reasoning_effort="none"` for strict extraction. Basic `json_object` only guarantees parseable JSON; testing still produced a top-level array, so it is not a substitute for schema validation.

## Context caching

* A short prefix of about 170 tokens did not hit; longer fixed prefixes produced cache reads.
* Explicit Chat `cache_control` hit 1,657 tokens on every subsequent pre-release call, and the second release check in the APIYI Default group also hit 1,657 tokens. Implicit cache hits were less consistent.
* Cached input is listed at \$0.075 per 1M tokens.

> [!WARNING]
>
> **Cache fields in usage are not a billing statement.** Use the billing detail on the individual console log to verify hits, cached token counts, and the final discount.

## Parameter compatibility

| Parameter | Observed behavior |
| - | - |
| `temperature` | `1.5` works; `2.0` returns a range error. Supported range: `[0.0, 2.0)` |
| `top_p` | Supported range: `(0.0, 1.0]` |
| `top_k` / `presence_penalty` / `frequency_penalty` | Supported |
| `stop` | Truncation works |
| `logprobs` / `top_logprobs` | Supported |
| `partial: true` | Prefix continuation works |
| `prefix: true` | Did not produce normal continuation; use `partial` |
| `n > 1` | Requires thinking to be disabled |
| `seed` | Identical seeds produced different outputs; determinism is not guaranteed |
| Unknown parameters | May be silently ignored; do not rely on this behavior |

The provider accepted `max_tokens=131072` and `200000` and returned short answers. This only shows that the values were not rejected; it does not verify generation at those lengths.

## FAQ

> [accordion] Why did I get HTTP 200 with an empty answer?
>
> Default reasoning can consume a small `max_tokens` budget, leaving no visible content and a `length` finish reason. Disable thinking or increase the output budget, and inspect `reasoning_content` and `finish_reason`.

> [accordion] Can I use Responses or Claude Code directly?
>
> Yes. Use the CodexResponses group for Responses clients and ClaudeCode for Claude Code; minimal requests on all three endpoints also passed with a Default-group token. Provider testing ignored `tool_choice="required"` on Responses, so prefer a named tool or Chat for forced structured calls. Messages does not support OpenAI-style `response_format` and requires `max_tokens`; use tool calling for structured output. Validate complex Claude Code agent workflows against your client version before broad rollout.

> [accordion] How can I reduce routine usage costs?
>
> Set `reasoning_effort="none"` for everyday chat and structured extraction, reuse fixed prefixes for long documents, verify cache billing in the console, and use eligible top-up bonus tiers.

> [accordion] Can I advertise a 200K maximum output?
>
> No. Accepting `max_tokens=200000` does not prove that 200K output was generated. This page does not assign a maximum output length based on that result.

## Related

* [Model pricing](https://docs.apiyi.com/en/models/index.md) — current prices, groups, and endpoints
* [Top-up promotions](https://docs.apiyi.com/en/faq/recharge-promotions.md) — bonus tiers and effective rates
* [Qwen3.8-Max overview](https://docs.apiyi.com/en/api-capabilities/qwen-3-8/overview.md) — previous generation
* [API manual](https://docs.apiyi.com/en/api-manual.md) — authentication, requests, and error handling

> [!NOTE]
>
> Measurements come from 325 pre-release calls on 2026-11-17 (UTC+8), plus 15 same-day release checks in the APIYI Default group covering Chat Completions, Responses, Messages, streaming, tools, JSON Schema, image, video, caching, and 32K context. Provider reference: `https://qwen.ai/blog?id=qwen4-max`. Model and channel behavior may change; live responses and console billing details are the source of truth.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.