Editorial

Qwen4-Max Agent Cost: Cache Breakpoints Decide

Qwen4-Max runs a 60-turn agent session for $1.43 with a cache breakpoint and $2.39 on implicit cache at 90% hits. Sonnet 5.5: $2.27.

JJyoti Ranjan SwainUpdated
Qwen4-Max agent session cost: $1.43 with a cache breakpoint, $2.39 on implicit cache at 90% hits, Sonnet 5.5 $2.27

Alibaba Cloud put Qwen4-Max on general release in Model Studio on 16 November 2026, five days after a preview that only Token Plan subscribers could reach. The list price is $1.50 per million input tokens and $4.50 per million output, flat across the whole 1M-token context and the same with thinking on or off. That undercuts Claude Sonnet 5.5 ($2 / $10) on both lines.

The headline rate is not what decides an agent bill, though. An agent re-sends the same long prefix every turn, so most of what you pay for is cache reads. Qwen4-Max has two ways to get them. One is a cache breakpoint you set yourself, which charges a 25% premium to write the prefix and then guarantees the hit. The other is the implicit cache, which costs nothing extra and guarantees nothing. I costed one 60-turn agent session both ways, and the gap between them is bigger than the gap between Qwen and Claude.

Table of contents

Qwen4-Max rate card

Per million tokens, from the Model Studio pricing page (International deployment, Singapore region), read on 17 November 2026.

LinePrice
Input, any request up to 1M tokens$1.50
Output, chain of thought plus answer$4.50
Cache write, 5-minute TTL$1.875
Cache write, 1-hour TTL$3.00
Cache read (explicit or implicit)$0.075
Free quota, Singapore only1 million tokens for 90 days

The read price is 5% of input. That's the number to watch. The generic Context Cache page says implicit hits usually bill at 20% of input and explicit hits at 10%, then lists qwen4-max as an exception to both ratios. If you budgeted from the generic page, you'd overestimate the cache line by a factor of 2 to 4.

For comparison, Anthropic lists Claude Sonnet 5.5 at $2 input, $10 output, $2.50 for a 5-minute cache write and $0.10 for a cache read.

Model page specs: 1,000,000-token context, 131,072 maximum output tokens in non-thinking mode, and 262,144 for thinking plus answer combined. Input can be text, images or video. Tier 1 accounts get 5,000,000 tokens per minute. The model speaks OpenAI Chat Completions, the Responses API, Anthropic Messages and DashScope, so most agent harnesses only need a new base URL and model ID.

One agent session three ways

This is the session used in every agent-cost post on this site, so it compares directly with the Inkling 2 Small post:

  • 60 turns
  • a 120,000-token prefix (system prompt, tool schemas, files), written once and read from cache on the other 59 turns
  • 3,000 new input tokens per turn
  • 1,500 output tokens per turn, reasoning included

That comes to 7.08 million prefix tokens re-sent from turn 2 onward, 180,000 new input tokens and 90,000 output tokens.

LineQwen4-Max, breakpointQwen4-Max, implicit at 90% hitsClaude Sonnet 5.5
Prefix write (120K)$0.225$0.18$0.30
Prefix reads$0.531$0.4779$0.708
Prefix misses$0$1.062$0
New input (180K)$0.27$0.27$0.36
Output (90K)$0.405$0.405$0.90
Session$1.43$2.39$2.27

60-turn agent session: Qwen4-Max $1.43 with a breakpoint, $2.39 on implicit cache at 90% hits, Claude Sonnet 5.5 $2.27

With a breakpoint, Qwen4-Max runs the session for 37% less than Sonnet 5.5. At 440 sessions a month (20 a day over 22 working days) that's $629.64 against $997.92.

Leave the cache on its defaults and miss one prefix token in ten, and Qwen costs more than Sonnet. Those 708,000 missed tokens bill at the full $1.50, which adds $1.06. That single line is bigger than the whole output bill.

If the implicit cache hit every time, it would be the cheapest option at $1.39, because it charges nothing extra for the first write. Alibaba's docs say it won't: the hit probability "is not 100%", and a miss can happen "even if the request context is identical".

How many cache misses erase the savings

The breakpoint costs $0.045 more than an implicit write on a 120K prefix ($1.875 against $1.50 per million). Each prefix token that misses on the implicit path costs $1.425 per million more than a hit. Divide one by the other: 31,579 missed tokens wipe out the premium. That is 0.45% of the 7.08 million tokens re-sent during the session, or about a quarter of one full prefix.

So the implicit cache has to hit more than 99.55% of the time to beat a breakpoint. One cold turn with the whole prefix missed is enough to lose.

Share of prefix served from cacheImplicit cache session
100%$1.39
99%$1.49
95%$1.89
90%$2.39
75%$3.91
50%$6.43
0%$11.48

Implicit cache session cost rises from $1.39 at 100% hits to $11.48 at 0%; a breakpoint holds it at $1.43

With zero hits the session costs eight times the breakpoint version. Prices this cheap make it easy to skip cache settings. Don't. You can rerun these numbers with your own token counts in the API cost calculator, which now lists Qwen4-Max.

Setting the breakpoint

The Qwen4 explicit cache page describes two ways to get deterministic hits.

Qwen4-Max request layout: system prompt, tools and files before the cache breakpoint, tool output and new turn after

A manual breakpoint goes on the last content block that stays identical across turns. The message holding it needs its content as an array:

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),  # placeholder: set YOUR_API_KEY in the env
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
)

SYSTEM = open("agent_system_prompt.md").read()  # no timestamps in here

resp = client.chat.completions.create(
    model="qwen4-max",
    messages=[
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": SYSTEM,
                    "prompt_cache_breakpoint": {"mode": "explicit"},
                }
            ],
        },
        *history,
    ],
    tools=TOOLS,  # same order and key order every call
    extra_body={"prompt_cache_options": {"ttl": "5m"}},
)
d = resp.usage.prompt_tokens_details
print(d.cached_tokens, d.cache_write_tokens)  # turn 2 onward: write should be 0

The other option is automatic caching. Set prompt_cache_options to {"mode": "implicit"} and the system puts a breakpoint at the end of each input for you. The name is confusing, since this is still the paid explicit cache with its write fee and its guaranteed hits. Sending no cache parameters at all is what gets you the free, best-effort implicit cache.

Automatic mode also writes each turn's new tail at the 125% rate. In the session above that's 180,000 tokens at $1.875 instead of $1.50, so $1.50 for the session rather than $1.43. In a real agent the history keeps growing and automatic mode turns old turns into reads, which a fixed system-prompt breakpoint can't do. Long sessions with heavy tool output probably come out ahead on automatic mode. Short ones with a big fixed prefix do better with one manual breakpoint.

Limits from the docs that will bite an agent loop:

  • The cached prefix needs at least 1,024 tokens.
  • Each breakpoint looks back at most 20 content blocks. A turn with many parallel tool results can push the prefix out of range. The docs suggest merging those results into one tool message with several content blocks.
  • A request keeps the last 4 breakpoints, and automatic mode uses one of the slots.
  • Use prompt_cache_breakpoint or the older cache_control marker, never both in one request.
  • Caches are reused only across requests from the same user. A pool of API keys for one agent splits its cache.
  • Tool definitions are serialized into the prefix. Change tool order or key order and the next turn writes the whole prefix again. A JSON formatter with sorted keys will show you when two tool payloads differ.

Five minutes or one hour

A 5-minute cache renews each time it's hit. An agent that answers in seconds keeps it warm indefinitely. The risk is the human in the loop. If someone reads a diff for ten minutes before approving, the cache has expired and the next turn writes all 120,000 prefix tokens again for $0.225.

A 1-hour write costs $0.36 for the same prefix, $0.135 more. A read of the prefix is $0.009. So a single pause longer than five minutes costs $0.216 extra on the 5-minute TTL (a fresh write instead of a read), which is more than the 1-hour premium. If your agent waits on a person even once per session, pay for the hour.

The renewal rules include one trap. A 1-hour request that hits a live 5-minute cache doesn't bill as a read. The hit portion is written again at the 1-hour rate. Pick a TTL per agent and keep it fixed, rather than raising it partway through a session.

Thinking tokens and the missing batch discount

Thinking is on by default at reasoning_effort high, with a thinking_budget of 131,072 tokens. The output column on the pricing page is labeled "chain of thought + answer", so reasoning bills at $4.50 per million. Supported efforts are low, high and xhigh. A request for medium maps to high, so asking for medium doesn't save anything.

Output is cheap enough that thinking hurts less here than on Claude. If each turn produced 6,000 output tokens instead of 1,500, the session would cost $2.65 on Qwen4-Max with a breakpoint and $4.97 on Sonnet 5.5.

Batch is the other catch. The Qwen-Max pricing section says models that support batch get 50% off input and output. The Qwen4-Max model page lists batch inference as not supported, and fine-tuning as not supported either. Nightly eval runs and bulk classification jobs that use batch on older Qwen models will pay full price after the switch.

FAQ

Is there a long-context surcharge?

No. Qwen4-Max has one pricing tier for requests from 0 to 1M input tokens. Its non-thinking input limit is 991,808 tokens and its thinking input limit is 983,616.

Can I run Qwen4-Max locally?

No weights have been released. It's an API model on Model Studio only. For open Qwen models you can run yourself, the AI VRAM calculator has Qwen3.8 presets.

Does Qwen3.8-Max cache the same way?

Partly. Qwen3.8-Max ($2 input, $6 output) writes explicit caches at 125% of input. The docs say its hit price isn't the generic 10%, but the public tables don't print the number, so I couldn't cost it. Prompt cache breakpoints with automatic mode and a 1-hour TTL are documented for Qwen4 only.

Sources

  • Alibaba Cloud Model Studio, Model pricing (alibabacloud.com/help/en/model-studio/model-pricing, read 17 November 2026): qwen4-max $1.5 input, $4.5 output, 0 to 1M tier, cache write $1.875 (5m) and $3 (1h), cache read $0.075, 1M-token free quota; batch 50% rule for supporting models; qwen3.8-max $2 / $6.
  • Alibaba Cloud Model Studio, qwen4-max model page (alibabacloud.com/help/en/model-studio/qwen4-max): context and output limits, thinking defaults and effort mapping, batch and fine-tuning not supported, Tier 1 TPM, supported APIs.
  • Alibaba Cloud Model Studio, Explicit cache (Qwen4) (alibabacloud.com/help/en/model-studio/explicit-cache-qwen4): prompt_cache_breakpoint, automatic caching via prompt_cache_options, TTL 5m or 1h, renewal rules, 20-block lookback, 4 breakpoints, same-user reuse, usage fields.
  • Alibaba Cloud Model Studio, Context Cache (alibabacloud.com/help/en/model-studio/context-cache): implicit cache behaviour and no-guarantee wording, generic 125% / 10% / 20% ratios and the qwen4-max exception, tool-definition caching rules.
  • Alibaba Cloud Model Studio, Changelog (alibabacloud.com/help/en/model-studio/newly-released-models): qwen4-max released 16 November 2026, qwen4-max-preview on Token Plan from 11 November 2026.
  • Anthropic, Claude API pricing (platform.claude.com/docs/en/about-claude/pricing, read 17 November 2026): Claude Sonnet 5.5 $2 input, $10 output, $2.50 5-minute cache write, $0.10 cache read.
  • Session, hit-rate, break-even and monthly figures are calculated by ToolMintX from the rates above.

Tools In This Article

Browser-based, no sign-up. Try them while the topic is fresh.

More From ToolMintX

Other Blog Posts