Set ANTHROPIC_DEFAULT_OPUS_MODEL to qwen4-max in Claude Code to connect to the GA version of Qwen4-Max as documented by QwenCloud; set the context window to 983616.
Suitable tasks: Using Qwen4-Max on QwenCloud through Claude Code
Unsuitable tasks: Tasks that require manually specifying an inference tier or thinking budget in Claude Code; the source does not provide a corresponding Claude Code configuration mapping
Supported model version: qwen4-max, as identified in the QwenCloud documentation; do not confuse it with the preview version, qwen4-max-preview
Supported client, agent, or API: Claude Code CLI, QwenCloud's Anthropic-compatible API
Recommended inference tier and parameters: Context window 983616; reasoning_effort=high and thinking_budget=131072 are listed by the source as server-side defaults, which are not mapped to Claude Code settings
First, get a Token Plan API Key from QwenCloud. Enter the key in the terminal and press Enter, then set the endpoint and model.
read -rs ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL="https://token-plan.maas.qwencloudapi.com/apps/anthropic"
export ANTHROPIC_MODEL="auto"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen3.6-flash"
export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen3.8-flash"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen4-max"
export CLAUDE_CODE_SUBAGENT_MODEL="auto"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="983616"If long outputs are truncated, you can also set:
export CLAUDE_CODE_MAX_OUTPUT_TOKENS="131072"Get the API Key for the relevant Token Plan from QwenCloud and set the variables above in the current terminal.
Explicitly select Qwen4-Max and run a text-only request. Claude Code CLI options
claude --model qwen4-max --tools "" --disallowedTools "mcp__*" -p "只回复 Hello"After confirming you receive a response, verify model routing and quota in a real task.
QwenCloud's Claude Code page says that when using the GA version, qwen4-max, set ANTHROPIC_DEFAULT_OPUS_MODEL to qwen4-max and keep CLAUDE_CODE_MAX_CONTEXT_TOKENS at 983616.
The page gives the Token Plan Anthropic-compatible endpoint as https://token-plan.maas.qwencloudapi.com/apps/anthropic and provides examples of model aliases, the subagent model, and the key variable.
The page says that if long outputs are truncated, you can set CLAUDE_CODE_MAX_OUTPUT_TOKENS=131072. The page's default values for reasoning_effort and thinking_budget do not have corresponding Claude Code settings.
The example uses the Token Plan endpoint and key configuration shown on the QwenCloud page. API keys depend on the plan and region; if using another billing method or region, adjust the settings according to the console and the relevant endpoint documentation.
ANTHROPIC_DEFAULT_OPUS_MODEL is the documented setting for selecting the GA model. The generic example includes qwen4-max-preview, the preview version; it has been replaced here with the GA version, qwen4-max.
CLAUDE_CODE_MAX_OUTPUT_TOKENS is optional when truncation occurs; it is not a required default setting.
Opened and checked QwenCloud's official Claude Code integration page through Tabbit on 2026-11-17. This article is based on the page's GA-version instructions; no API request was sent using a real key.
Qwen4-Max