Qwen4-Max in Claude Code: Setup, Pricing, and Preview Migration
Connect qwen4-max to Claude Code through QwenCloud's pay-as-you-go or Token Plan endpoint. Compare token charges, cache creation costs, and published coding results with Qwen3.8-Max and Opus 5.5. Replace the preview ID before retirement, distinguish API limits from Claude Code's output cap, and verify a real repository task.
Contents

To try Qwen4-Max in Claude Code without a Token Plan subscription, use QwenCloud’s pay-as-you-go API and select qwen4-max explicitly. This gives developers comparing it with Qwen3.8-Max or Opus 5.5 a direct, token-billed starting point. Existing users should replace qwen4-max-preview before its preview window ends on November 25, 2026, at 24:00 UTC+8.
Availability, limits, and prices below are as of November 17, 2026.
What changed from the preview?
The November 16 production release adds pay-as-you-go access alongside Token Plan; the preview was Token Plan-only. Use qwen4-max, not qwen4-max-preview, for the production model.
Keep the API limits separate from Claude Code’s settings. The production specification lists a 1,000,000-token context, with maximum thinking-mode input of 983,616 tokens. Output allows 131,072 tokens without thinking, or 262,144 tokens for thinking and the final answer combined.
The preview specification allowed 393,216 tokens shared by thinking and the answer. The production API therefore has a lower combined output ceiling, even though QwenCloud recommends a larger Claude Code output setting.
The preview ends at the close of November 25, equivalent to November 26 at 00:00 UTC+8, and is scheduled for retirement afterward. Replace explicit preview references in your shell and client configuration, restart the client, and verify the production ID. Do not rely on another application’s automatic upgrade to migrate your Claude Code settings.
Which access route should you use?
Choose pay-as-you-go for a measured API trial or application integration. Choose Token Plan for interactive coding within its subscription allowance.
| Route | Requirements and billing | When to choose it |
|---|---|---|
| QwenCloud pay-as-you-go | QwenCloud account, matching regional API key and endpoint, and enabled billing; model tokens are billed separately for input and output. | A direct Qwen4-Max cost test, application backend, or automation. |
| QwenCloud Token Plan | QwenCloud subscription through the Singapore service, dedicated Token Plan key and endpoint; usage consumes Credits. | Interactive work in supported coding tools, with a monthly allowance. |
| OpenRouter | Funded OpenRouter account and a compatible client; use qwen/qwen4-max. Credit-purchase fees apply. | You already compare providers through OpenRouter. |
| BetterToken, for alternative models | Your own account and API key, pay-as-you-go model billing, and documented Claude Code configuration. | Compare other available models and routes; check current models and prices. |
Token Plan Lite has a standard list price of $6/month and 20,000 Credits, not 20,000 tokens. Its usage policy excludes automation scripts, application backends, and non-interactive batch calls. Exhausting the plan and Credit Packs does not automatically switch requests to pay-as-you-go.
OpenRouter’s funding fees matter when comparing total spend, not just displayed token rates. BetterToken API access is separate from vendor subscriptions. Check account activation and available payment methods before replacing a working route.
Singapore pay-as-you-go offers 1 million free tokens, separate from Token Plan Credits. Check the free-quota eligibility and expiration rules; do not assume that allowance remains available in your account.
Configure Qwen4-Max in Claude Code
Use an installed Claude Code CLI and a QwenCloud pay-as-you-go key created in Singapore. Select the region in the console, open API Keys, and create a key.
Run this in Bash, after checking for stale provider overrides in ~/.claude/settings.json and your project’s .claude/settings.json. When the first command waits, paste the key and press Enter. The input is not echoed or saved in shell history.
read -rs ANTHROPIC_AUTH_TOKEN && export ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL="https://ap-southeast-1.maas.qwencloudapi.com/apps/anthropic"
export ANTHROPIC_MODEL="qwen4-max"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen4-max"
export CLAUDE_CODE_SUBAGENT_MODEL="qwen4-max"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="983616"
claude -p "Hello"
This uses QwenCloud’s documented Anthropic-compatible endpoint and model-specific instructions. Its generic pay-as-you-go example still names qwen3.7-max; the model values above intentionally select the production Qwen4-Max.
ANTHROPIC_MODEL selects the main model. ANTHROPIC_DEFAULT_OPUS_MODEL maps Claude Code’s Opus alias; setting that alias alone is not the same as selecting the active model. These exports apply to the current terminal.
A reply confirms basic authentication and routing. Next, run this inside a repository containing README.md:
claude -p "Read README.md and report the project name and any documented test command. Do not edit files."
Compare the answer with the file. Successful access should produce repository-specific facts without modifying files. Then try a small change with an existing test, rather than treating a greeting as proof of coding-tool compatibility.
Using an existing Token Plan instead
Keep the qwen4-max model settings above, but replace both the credential and endpoint with the Token Plan pair:
read -rs ANTHROPIC_AUTH_TOKEN && export ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL="https://token-plan.maas.qwencloudapi.com/apps/anthropic"
claude
Paste your dedicated Token Plan key, not the pay-as-you-go key. Perform the repository check interactively in Claude Code. Use the pay-as-you-go route for unattended automation.
Long output and failed requests
For truncated long answers, QwenCloud recommends changing the preview-era 64000 setting to:
export CLAUDE_CODE_MAX_OUTPUT_TOKENS="131072"
Launch a new Claude Code session from that terminal. This is QwenCloud’s recommended client setting, not a promise that the CLI will return 131,072 tokens. Current Claude Code documentation caps unrecognized model IDs at 128000 output tokens and clamps higher settings. Neither value grants the API’s 262,144-token combined thinking-and-answer allowance. Split a large deliverable into separate requests when the client cap is the remaining constraint.
For authentication failures, check the credential type and region before rotating keys repeatedly. QwenCloud’s region rules require the API key and regional endpoint to match.
For Token Plan errors, distinguish 429 insufficient_quota from 429 Requests rate limit exceeded using the official error guide. For exhausted quota, wait for a reset or purchase a Credit Pack. For rate limiting, reduce request frequency or concurrency instead. After correcting the cause, retry one small interactive request.
For recurring context errors, keep the explicit 983616 setting and check Claude Code’s gateway context-window behavior before increasing limits.
Calculate token charges before comparing task costs
Use the Singapore rates for this configuration. Do not combine another region’s price with the Singapore endpoint.
The following estimate assigns each model the same 100,000 uncached input tokens and 10,000 billed output tokens, including reasoning. It isolates model-token charges: no cache, paid hosted tools, funding fees, or taxes are included.
| Model and direct route | Input per 1M tokens | Output per 1M tokens | Estimated model-token charge |
|---|---|---|---|
| Qwen4-Max, Singapore | $1.50 | $4.50 | $0.195 |
| Qwen3.8-Max, Singapore | $2.00 | $6.00 | $0.260 |
| Claude Opus 5.5, standard API | $4.00 | $20.00 | $0.600 |
For Qwen4-Max, the calculation is 0.1 × $1.50 + 0.01 × $4.50 = $0.195. These are hypothetical charges, not observed costs for completing the same coding task. Models can consume different amounts of reasoning, context, and retries. QwenCloud documents defaults of reasoning_effort=high and thinking_budget=131072; that budget is a ceiling, not billed usage.
Include cache creation, not only cache reads
Qwen4-Max’s Singapore cache-read price is $0.075 per 1M tokens for both implicit and explicit hits. Explicit creation costs $1.875 per 1M tokens for a 5-minute cache, or $3.00 for a 1-hour cache.
With token amounts in millions, calculate:
cost_USD = 1.50U + 0.075R + 1.875W5 + 3.00W60 + 4.50O
Here, U is uncached input, R is cache-read input, and W5 and W60 are cache writes at each lifetime. Count each input token in one category. O includes thinking and the final answer.
For a complete example, assume two requests each contain a stable 100,000-token prefix, 5,000 new input tokens, and 2,000 output tokens. The first writes the prefix; the second hits that 5-minute cache.
The estimated combined charge is 0.010 × $1.50 + 0.100 × $0.075 + 0.100 × $1.875 + 0.004 × $4.50 = $0.228. Without caching, the same token volumes cost 0.210 × $1.50 + 0.004 × $4.50 = $0.333.
That example assumes a successful cache hit. Use the provider’s cache usage fields to check actual reads and writes. For repeated coding sessions, also inspect Claude Code’s background-agent token overhead before attributing every charge to the main answer.
Is it a better coding choice than Opus 5.5?
Start with Qwen4-Max for a cost-sensitive, bounded repository task. Keep Opus 5.5 as the comparison for difficult terminal work until your own acceptance tests justify switching.
As of November 17, the Vals AI Terminal-Bench 4.0 leaderboard reports:
| Published model entry | Mini-SWE-agent score | Cost per test |
|---|---|---|
| Qwen 4 Max | 48.48% | $3.90 |
| Qwen 3.8 Max 0902 | 38.89% | $12.15 |
| Claude Opus 5.5 | 65.15% | $12.04 |
This supports a narrower conclusion than “Opus replacement”: Qwen4-Max improves on the dated Qwen3.8-Max entry while trailing Opus on these terminal tasks. Cost per test is not cost per successfully accepted patch.
These are published agent runs, not matched-effort Claude Code tests. Vals reported Qwen4-Max at xhigh; its Opus page lists max. Its launch-era Opus report also disclosed fallback models, so the live table should not be treated as a controlled, fallback-free comparison. Review how effort and fallback affect coding-agent comparisons before extrapolating the difference.
Cap your first trial at 30 minutes. Choose one small issue with a known acceptance test, keep the repository state and instructions fixed, and record total charges across retries. Adopt Qwen4-Max for that task class when it meets the same acceptance criteria at an acceptable total cost; retain Opus where extra retries or repairs erase the token-price advantage.