---
title: "Qwen4 Max"
description: "A closed-weight model from the Qwen family, released November 2026, that ranks near the top of the Intelligence index. It stands out for a perfect score on competition mathematics and a very large context window, though its price sits well above the median."
canonical: https://pydantic.dev/models/list/qwen4-max/
---

# Qwen4 Max

> A closed-weight model from the Qwen family, released November 2026, that ranks near the top of the Intelligence index. It stands out for a perfect score on competition mathematics and a very large context window, though its price sits well above the median.
>
> Markdown copy of [https://pydantic.dev/models/list/qwen4-max/](https://pydantic.dev/models/list/qwen4-max/). Index for agents: [llms.txt](https://pydantic.dev/models/llms.txt)

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: [select.md](https://pydantic.dev/models/select.md)
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/api/ask?query=<question>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of all but the single model. An `OPTIONS` request to any endpoint returns its schema. The same five are tools of the MCP server at `https://pydantic.dev/models/mcp`. More: [usage.md](https://pydantic.dev/models/usage.md)

Use it with Pydantic AI as `together:Qwen/Qwen4-Max`.

## Spec sheet

- **Type:** writes text
- **Family:** Qwen
- **Released:** 16 Nov 2026
- **Weights:** closed
- **Context window:** 1,000,000 tokens
- **Largest response:** 262,144 tokens
- **Accepts:** text, image, video
- **Tool calling:** yes
- **Knowledge cutoff:** unknown
- **Intelligence index:** 76.5 (rank 8)
- **Scores updated:** 2026-12-04
- **Price:** $1.43 input, $4.28 output, $2.14 blended per 1M tokens
- **Index points per $:** 35.8 (rank 49)
- **Speed:** 68 tokens/sec (rank 96)
- **Popularity:** rank 50 of 222 by usage
- **Pydantic AI Gateway:** not built in; [bring your own key](https://ai.pydantic.dev/gateway/#bring-your-own-key)

## Benchmarks


| Benchmark                | Score | Rank among models tested | What it measures                                                                                 | Source                                    |
| ------------------------ | ----- | ------------------------ | ------------------------------------------------------------------------------------------------ | ----------------------------------------- |
| Intelligence index       | 76.5  | 8                        | Our composite of the benchmarks below, 0-100                                                     | Pydantic, from the sources credited below |
| GPQA Diamond             | 94%   | 18                       | Graduate-level science questions, multiple choice                                                | Epoch AI (CC BY 4.0)                      |
| OTIS Mock AIME           | 100%  | 1                        | Competition mathematics problems with exact answers                                              | Epoch AI (CC BY 4.0)                      |
| FrontierMath             | 78.6% | 26                       | Original research-level mathematics problems, tiers 1 to 3                                       | Epoch AI (CC BY 4.0)                      |
| SimpleQA Verified        | 54.1% | 29                       | Short factual questions answered from memory, without search                                     | Epoch AI (CC BY 4.0)                      |
| APEX-Agents              | 67.4% | 13                       | Long professional tasks (banking, consulting, law) passed on the first attempt                   | Mercor, via Epoch AI (CC BY 4.0)          |
| FrontierMath Tier 4      | 53.7% | 27                       | Research-level mathematics problems, the hardest tier, with checkable answers                    | Epoch AI (CC BY 4.0)                      |
| Chess Puzzles            | 36%   | 48                       | Find the single best move in a chess position                                                    | Epoch AI (CC BY 4.0)                      |
| Mystery Game Puzzles     | 36%   | 26                       | Best-move puzzles in an undisclosed well-known game                                              | Epoch AI (CC BY 4.0)                      |
| Furniture Assembly       | 34.2% | 30                       | Spot assembly mistakes in photos of flat-pack furniture builds                                   | Epoch AI (CC BY 4.0)                      |
| ALE-Bench                | 1831  | 19                       | Hard optimisation contest problems, as a rating against human contestants                        | Sakana AI, via Epoch AI (CC BY 4.0)       |
| Epoch Capabilities Index | 159.8 | 25                       | Epoch AI's own composite across about 40 benchmarks; shown for comparison, not part of our index | Epoch AI (CC BY 4.0)                      |

## Providers and prices

US dollars per million tokens.

| Provider    | Gateway | Pydantic AI string        | Input | Cached input | Output |
| ----------- | ------- | ------------------------- | ----- | ------------ | ------ |
| Novita      | BYOK    | –                         | $1.41 | $0.071       | $4.24  |
| Together AI | BYOK    | `together:Qwen/Qwen4-Max` | $1.43 | $0.071       | $4.28  |
| Fireworks   | BYOK    | `fireworks:qwen4-max`     | $1.5  | $0.075       | $4.5   |

## Use Qwen4 Max with Pydantic AI

### hello.py

Ask Qwen4 Max a question with a Pydantic AI agent and print the answer. Run it with uv run hello.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic_ai import Agent

os.environ['TOGETHER_API_KEY'] = '...'

agent = Agent('together:Qwen/Qwen4-Max', instructions='Be concise, reply with one sentence.')

result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
```

### structured_output.py

Get validated, typed output from Qwen4 Max by giving the agent a Pydantic model. Run it with uv run structured_output.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os

from pydantic import BaseModel
from pydantic_ai import Agent

os.environ['TOGETHER_API_KEY'] = '...'


class CityLocation(BaseModel):
    city: str
    country: str


agent = Agent('together:Qwen/Qwen4-Max', output_type=CityLocation)

result = agent.run_sync('Where were the olympics held in 2012?')
print(result.output)
#> city='London' country='United Kingdom'
```

### tools.py

Give Qwen4 Max two tools to call, one of which reads the agent's dependencies. Run it with uv run tools.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import os
import random

from pydantic_ai import Agent, RunContext

os.environ['TOGETHER_API_KEY'] = '...'

agent = Agent(
    'together:Qwen/Qwen4-Max',
    deps_type=str,
    instructions="You're a dice game, roll the die and see if it matches the user's guess.",
)


@agent.tool_plain
def roll_dice() -> str:
    """Roll a six-sided die and return the result."""
    return str(random.randint(1, 6))


@agent.tool
def get_player_name(ctx: RunContext[str]) -> str:
    """Get the player's name."""
    return ctx.deps


result = agent.run_sync('My guess is 4', deps='Anne')
print(result.output)
```

### streaming.py

Stream Qwen4 Max's reply to the terminal as it is generated. Run it with uv run streaming.py.

```python
# /// script
# dependencies = ["pydantic-ai"]
# ///
import asyncio
import os

from pydantic_ai import Agent

os.environ['TOGETHER_API_KEY'] = '...'

agent = Agent('together:Qwen/Qwen4-Max')


async def main():
    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:
        async for text in response.stream_text(delta=True):
            print(text, end='', flush=True)


asyncio.run(main())
```

### pax.sh

Code with Qwen4 Max in your terminal using Pax, the Pydantic AI coding agent.

```sh
export TOGETHER_API_KEY='...'

uv run --from pydantic-ai-pax pax -m 'together:Qwen/Qwen4-Max'
```

### codex.sh

Run OpenAI's Codex CLI on Qwen4 Max, which Together AI serves over an OpenAI-compatible API.

```sh
# npm install -g @openai/codex
export TOGETHER_API_KEY='...'

codex --model 'Qwen/Qwen4-Max' \
  -c model_provider='together' \
  -c model_providers.together.name='Together AI' \
  -c model_providers.together.base_url='https://api.together.example/v1' \
  -c model_providers.together.env_key='TOGETHER_API_KEY'
```

### ai_sdk.ts

Call Qwen4 Max from TypeScript with the Vercel AI SDK.

```ts
// npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from '@ai-sdk/openai-compatible'
import { generateText } from 'ai'

process.env.TOGETHER_API_KEY = '...'

const together = createOpenAICompatible({
  name: 'together',
  baseURL: 'https://api.together.example/v1',
  apiKey: process.env.TOGETHER_API_KEY,
})

const { text } = await generateText({
  model: together('Qwen/Qwen4-Max'),
  system: 'Be concise, reply with one sentence.',
  prompt: 'Where does "hello world" come from?',
})
console.log(text)
```

## About Qwen4 Max

Qwen4 Max costs $1.43 per million input tokens and $4.28 per million output tokens, has a 1M token context window and scores 76.5 on our intelligence index, #8 of 106.

Qwen4 Max is a closed-weight model released in November 2026. It has a 1M token context window, up to 262k tokens of output, and accepts text, image and video input. It supports tool calling, reasoning mode and structured output, and is offered through Novita, Together AI and Fireworks.

Its strongest results are in mathematics and overall capability. It ranks 8th of 109 on the Intelligence index with 76.5, against a median of 58.7, and scores 100% on OTIS Mock AIME, first of 101. On FrontierMath Tier 4 it reaches 53.7%, 27th of 75. Its results on Chess Puzzles and Furniture Assembly fall below the median, while its APEX-Agents score of 67.4% ranks 14th of 65.

Cost is the main trade-off. At $1.43 per million input tokens and $4.28 per million output, its blended price is $2.14 against a median of $0.80, placing it 137th of 222 on price. Its intelligence per dollar ranks 49th of 222, a better position than its price rank.

**Strengths**

- 76.5 Intelligence index, 8th of 109 against a median of 58.7
- 100% on OTIS Mock AIME, 1st of 101
- 53.7% on FrontierMath Tier 4, 27th of 75 against a median of 31.7
- 1M context window, 262k maximum output, accepts text, image and video

**Weaknesses**

- Blended price $2.14 per million tokens, against a median of $0.80
- 34.2% on Furniture Assembly, 30th of 46, below the median of 42.5%
- 36.0% on Chess Puzzles, 50th of 84, below the median of 41.0%

**Best for:** Agents needing strong reasoning and mathematics, image or video input, or long context, where a higher token price is acceptable.

Prices come from [genai-prices](https://github.com/pydantic/genai-prices), in US dollars per million tokens. Benchmark scores come from Epoch AI and LMArena (CC BY 4.0), Browser Use, our own Pydantic AI benchmarks (CC BY 4.0), and, for decision models, Artificial Analysis and the Jev Decision Index; the index and its sources are described in [the methodology](https://pydantic.dev/models/methodology.md). Data built 2026-12-04. This model from the API: `https://pydantic.dev/models/api/models/qwen4-max`. Compare it with others: `https://pydantic.dev/models/api/models?slug=qwen4-max,<other slug>`
