Qwen3.8-Max API
Answer questions about images, video and text in one chat model, with thinking effort adjustable from fully off to maximum and a 1,000,000-token context.
- Context window
- 1M tokens
- Max output
- 131.1K tokens
- Input
- $2 / 1M tokens
- Output
- $6 / 1M tokens
- Cached input
- $0.25 / 1M tokens
- Modalities
- text + image + video → text
- Features
- reasoningtool callingjson modestreaming
Connect to Qwen3.8-Max
Qwen3.8-Max is served through an OpenAI-compatible chat completions API. Point any OpenAI SDK or OpenAI-compatible tool at the base URL below with a ModelRunner API key — no polling, the reply comes back in the response (or streams).
- base_url
- https://queue.modelrunner.run/alibaba/qwen3.8-max
- model
- alibaba/qwen3.8-max
- auth
- Authorization: Bearer <MODELRUNNER_API_KEY>get a key
import os
from openai import OpenAI
client = OpenAI(
base_url="https://queue.modelrunner.run/alibaba/qwen3.8-max",
api_key=os.environ["MODELRUNNER_API_KEY"],
)
completion = client.chat.completions.create(
model="alibaba/qwen3.8-max",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://media.modelrunner.ai/RUzu91W6MnzSN2S01RjJg.png"
}
},
{
"type": "text",
"text": "Read the sign in this photo exactly as written, then tell me how many birds are perched on it. Answer in two short lines."
}
]
}
],
reasoning_effort="medium", # low | medium | high — thinking bills as output tokens
)
print(completion.choices[0].message.content)
# Streaming: add stream=True and iterate the chunks
# for chunk in client.chat.completions.create(..., stream=True):
# print(chunk.choices[0].delta.content or "", end="")import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://queue.modelrunner.run/alibaba/qwen3.8-max",
apiKey: process.env.MODELRUNNER_API_KEY,
});
const completion = await client.chat.completions.create({
model: "alibaba/qwen3.8-max",
messages: [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://media.modelrunner.ai/RUzu91W6MnzSN2S01RjJg.png"
}
},
{
"type": "text",
"text": "Read the sign in this photo exactly as written, then tell me how many birds are perched on it. Answer in two short lines."
}
]
}
],
reasoning_effort: "medium", // low | medium | high — thinking bills as output tokens
});
const reply = completion.choices[0].message.content;
// Streaming: pass stream: true and iterate the chunks
// for await (const chunk of await client.chat.completions.create({ ..., stream: true })) {
// process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
// }# One synchronous call — the reply is in the response body (no polling)
curl https://queue.modelrunner.run/alibaba/qwen3.8-max/chat/completions \
-H "Authorization: Bearer $MODELRUNNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://media.modelrunner.ai/RUzu91W6MnzSN2S01RjJg.png"
}
},
{
"type": "text",
"text": "Read the sign in this photo exactly as written, then tell me how many birds are perched on it. Answer in two short lines."
}
]
}
],
"reasoning_effort": "medium"
}'
# Streaming (Server-Sent Events, ends with "data: [DONE]")
curl -N https://queue.modelrunner.run/alibaba/qwen3.8-max/chat/completions \
-H "Authorization: Bearer $MODELRUNNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://media.modelrunner.ai/RUzu91W6MnzSN2S01RjJg.png"
}
},
{
"type": "text",
"text": "Read the sign in this photo exactly as written, then tell me how many birds are perched on it. Answer in two short lines."
}
]
}
],
"reasoning_effort": "medium",
"stream": true
}'Works withCline · Continue · Claude Code · LangChain · Vercel AI SDK · LiteLLM · Aider
Cline → Settings → API Configuration (or the CLI line below)
API Provider: OpenAI Compatible
Base URL: https://queue.modelrunner.run/alibaba/qwen3.8-max
API Key: <your ModelRunner API key>
Model ID: alibaba/qwen3.8-max
# Cline CLI equivalent
cline auth --provider openai --baseurl https://queue.modelrunner.run/alibaba/qwen3.8-max --modelid alibaba/qwen3.8-max --apikey <your ModelRunner API key>~/.continue/config.yaml (the IDE extension and the `cn` CLI read the same file)
models:
- name: Qwen3.8-Max (ModelRunner)
provider: openai
model: alibaba/qwen3.8-max
apiBase: https://queue.modelrunner.run/alibaba/qwen3.8-max
apiKey: <your ModelRunner API key>
roles: [chat, edit]shell environment (or the env block of ~/.claude/settings.json)
export ANTHROPIC_BASE_URL=https://queue.modelrunner.run/alibaba/qwen3.8-max
export ANTHROPIC_AUTH_TOKEN=<your ModelRunner API key>
export ANTHROPIC_MODEL=alibaba/qwen3.8-max
# optional: send Claude Code's background/sub-agent calls to the same model
export ANTHROPIC_DEFAULT_HAIKU_MODEL=alibaba/qwen3.8-max
export CLAUDE_CODE_SUBAGENT_MODEL=alibaba/qwen3.8-max
claudeimport os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://queue.modelrunner.run/alibaba/qwen3.8-max",
api_key=os.environ["MODELRUNNER_API_KEY"],
model="alibaba/qwen3.8-max",
)
llm.invoke("Explain what an API rate limit is in two sentences.")import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const modelrunner = createOpenAICompatible({
name: "modelrunner",
baseURL: "https://queue.modelrunner.run/alibaba/qwen3.8-max",
apiKey: process.env.MODELRUNNER_API_KEY,
});
const { text } = await generateText({
model: modelrunner("alibaba/qwen3.8-max"),
prompt: "Explain what an API rate limit is in two sentences.",
});import os
import litellm
response = litellm.completion(
model="openai/alibaba/qwen3.8-max", # "openai/" = OpenAI-compatible route
api_base="https://queue.modelrunner.run/alibaba/qwen3.8-max",
api_key=os.environ["MODELRUNNER_API_KEY"],
messages=[{"role": "user", "content": "Explain what an API rate limit is in two sentences."}],
)
print(response.choices[0].message.content)terminal
export OPENAI_API_BASE=https://queue.modelrunner.run/alibaba/qwen3.8-max
export OPENAI_API_KEY=<your ModelRunner API key>
aider --model openai/alibaba/qwen3.8-maxStreaming via SSE (stream: true; ends with data: [DONE]) · Non-streaming calls time out at ~290 s — stream long generations · 10 MB request body · Errors use the OpenAI error envelope · Optional metadata object for your own tags, never sent to the model · Many models, one provider entry: base_url https://queue.modelrunner.run/v1 (GET /v1/models lists ids; model field required)
From an MCP client (Claude Desktop, Cursor, Claude Code): connect the ModelRunner MCP server once and its run_model tool runs Qwen3.8-Max with a messages input — the reply comes back in the same call.
Machine-readable: OpenAPI schema · llms.txt
Example conversation
A real run of Qwen3.8-Max on ModelRunner · charged $0.0017 · 810 in / 13 out tokens

PUFFIN COVE 3.7 km 2
Model Pricing
Pricing
This model is billed per token, at separate rates for what you send and what it produces.
If a run reports no token usage, it bills a flat $0.02.
Real run: the example conversation above was charged $0.0017 for 810 input and 13 output tokens.
Cost estimator
Estimate from the rates above — your bill is the model's reported usage × rate, exact to 6 decimals.
This model thinks before it answers. Thinking tokens bill at the output rate and are often several times the visible reply — count them in the output figure, or set a lower reasoning effort.
Compare tiers and related models
| Model | Input / 1M | Output / 1M | Context | Max output | Features |
|---|---|---|---|---|---|
| Qwen3.8-Maxalibaba/qwen3.8-max | $2 | $6 | 1M | 131.1K | reasoning, tool calling, json mode |
| DeepSeek V4 Prodeepseek/v4 | $2.4 | $4.8 | 1M | 393.2K | reasoning, tool calling, json mode |
| Gemini 3.5 Flashgoogle/gemini-3.5-flash | $1.5 | $9 | 1M | 65.5K | reasoning, tool calling, json mode |
| Gemini 3.5 Flash-Litegoogle/gemini-3.5-flash-lite | $0.3 | $2.5 | 1M | 65.5K | tool calling, json mode |
| Gemini 3.7 Flashgoogle/gemini-3.7-flash | $0.75 | $3.75 | 1M | 65.5K | reasoning, tool calling, json mode |
| GLM-5.2z-ai/glm-5.2 | $1.4 | $4.4 | 1M | 131.1K | reasoning, tool calling, json mode |
| GLM-5.2 Fast Previewz-ai/glm-5.2-fast-preview | $2.8 | $8.8 | 1M | 131.1K | reasoning, tool calling, json mode |
Request parameters
The body follows OpenAI’s chat completions shape. Fields below are the ones this model documents; anything else the platform does not interpret is forwarded to the model unchanged, and the model is the authority on what it accepts.
| Name | Type | Required | Description |
|---|---|---|---|
| messages | array | yes | OpenAI-style conversation history. Each item is an object with a role (system, user, assistant or tool) and content. This model reads images and video as well as text, so content may be a plain string or an array of content parts — an image part has type image_url and carries the image URL at image_url.url, and up to 2,048 images fit in one request. |
| stream | boolean | no | Return the reply as a Server-Sent Events stream of deltas terminated by data: [DONE]. Default: false. |
| reasoning_effort | enum | no | How hard the model thinks before answering. Defaults to xhigh, which is already the maximum tier: high and max resolve to the same behaviour, minimal and low to the low tier, medium is its own tier, and none switches thinking off completely. Thinking tokens bill as output tokens, so lowering this is the main cost lever. One of: none, minimal, low, medium, high, xhigh, max. Default: "xhigh". |
| thinking_budget | integer | no | Ceiling on chain-of-thought tokens. Defaults to 262,144, the maximum chain-of-thought length published for this model; the 131,072-token reply ceiling is published as its own separate figure. When the limit is reached the model stops reasoning and responds immediately. Default: 262144. |
| max_tokens | integer | no | Upper bound on the generated reply, up to the documented 131,072-token output ceiling. That ceiling is the same in thinking and non-thinking mode. |
| tools | array | no | OpenAI-format tool definitions the model may call. |
| tool_choice | — | no | auto, none, required, or a specific tool. |
| response_format | object | no | Structured-output control. Set its type to json_object to force a JSON reply. Thinking is on by default and the brand documents that a thinking-mode reply may not be strictly valid JSON, so pair this with reasoning_effort set to none when the output has to parse. |
| stop | — | no | Up to 4 stop sequences. |
| seed | integer | no | Best-effort determinism hint. |
Response
An OpenAI ChatCompletion object: id, object, created, model, choices[] and usage. Cache hits surface at usage.prompt_tokens_details.cached_tokens; thinking at usage.completion_tokens_details.reasoning_tokens, which is nested inside completion_tokens — thinking tokens are billed as output tokens. The id is chatcmpl-<requestId>, and the same request appears in your dashboard.
About Qwen3.8-Max
Qwen3.8-Max is a thinking model that reads images and video as well as text and answers in text. The multimodal input is what sets it apart from most chat models: put a screenshot or a video clip straight into a `messages` turn — up to 2,048 images in one request — and ask a question whose answer is only visible in the picture. It is a 2.4-trillion-parameter mixture-of-experts model, and the brand publishes 86.6 on Terminal Bench 2.1, 93.0 on PaperBench and 67.7 on SWE-bench Pro for agentic coding, plus 82.3 on MMMU-Pro and 95.2 on MathVision for vision.
Best for
- Ask questions about a screenshot, chart or photo and get a written answer
- Describe or summarise what happens in a video clip
- Agentic coding: multi-step debugging, refactoring and terminal tasks
- Turn thinking off for fast cheap answers, or dial it up for hard problems
- Read a whole codebase or document set in one million-token prompt
How it thinks
Qwen3.8-Max reasons before it answers. Set reasoning_effort to none, minimal, low, medium, high, xhigh or max (default xhigh) to trade answer quality against latency and cost. Thinking tokens are billed at the output rate and reported as usage.completion_tokens_details.reasoning_tokens.
Notesshow the full description ›
Thinking is on by default. `reasoning_effort` accepts seven spellings that resolve to four real behaviours: `none` switches reasoning off completely, `minimal` and `low` give the low tier, `medium` is its own tier, and `high`, `max` and `xhigh` are all maximum intensity. `xhigh` is the default, so an untuned request already thinks as hard as this model can, and since thinking tokens bill as output tokens, lowering the effort is the biggest cost lever. `thinking_budget` caps the chain of thought; when the cap is reached the model stops reasoning and answers immediately.
The context window is 1,000,000 tokens and one reply can run to 131,072, the same ceiling in thinking and non-thinking mode. The documented maximum chain-of-thought length is 262,144 tokens. Repeated prompt prefixes are cached automatically and bill at the reduced cached-input rate, so a stable system prompt is cheap to resend.
## Choose another model when - Your input is audio — this model reads text, images and video; send speech to a transcription model - You want the cheapest possible tokens for bulk classification, tagging or translation — this model thinks at maximum effort by default and bills thinking as output - A single reply has to exceed 131,072 tokens, the published output ceiling in both thinking and non-thinking mode - You need to fine-tune on your own data — this model is inference-only
## Tips - Pair `response_format` with `reasoning_effort: "none"` when you need strictly valid JSON — thinking mode is documented to sometimes return content that is not strictly valid JSON - Cost is driven by how much the model generates, not how much you send — capping `max_tokens` and lowering `reasoning_effort` move the bill more than trimming the prompt - `usage.completion_tokens_details.reasoning_tokens` reports how much of a reply went to thinking
Behaviour & limits
- Context window
- 1M tokens (input + output)
- Max output
- 131.1K tokens per reply — thinking counts against this budget
- Structured calls
- OpenAI-format tools + tool_choice · response_format JSON mode
- Transport
- OpenAI-compatible chat completions · SSE streaming · ~290 s non-stream ceiling · 10 MB body
FAQ
How do I connect to Qwen3.8-Max through the API?
Qwen3.8-Max is served by an OpenAI-compatible chat completions endpoint. Point any OpenAI SDK or OpenAI-compatible tool at base_url https://queue.modelrunner.run/alibaba/qwen3.8-max with a ModelRunner API key (Authorization: Bearer <key>) and model alibaba/qwen3.8-max; the SDK appends /chat/completions itself. The call is synchronous — the reply comes back in the response body, or streams as Server-Sent Events with "stream": true. Do not submit it to the asynchronous queue path, which returns HTTP 400 for this model.
How much does Qwen3.8-Max cost?
Qwen3.8-Max is billed per token from the usage the model reports: $2 per 1M input tokens, $0.25 per 1M cached input tokens, $6 per 1M output tokens. Thinking (reasoning) tokens bill at the output rate. There is no per-request minimum — a short call bills a fraction of a cent, exact to six decimals.
What is Qwen3.8-Max's context window?
Qwen3.8-Max supports a 1M-token context window and up to 131.1K output tokens per reply — thinking tokens count against the output budget, so leave headroom in max_tokens.
Can I use Qwen3.8-Max in GitHub Copilot or another tool that requires a /models endpoint?
Yes. Custom-provider flows that probe GET {base_url}/models before first use (GitHub Copilot's BYOK flow does) work with either base URL: https://queue.modelrunner.run/alibaba/qwen3.8-max self-describes at https://queue.modelrunner.run/alibaba/qwen3.8-max/models, and the platform base https://queue.modelrunner.run/v1 covers every public chat model with one provider entry — GET /v1/models lists the ids and the request's model field selects alibaba/qwen3.8-max.
Does Qwen3.8-Max support streaming?
Yes. Set "stream": true and the reply arrives as Server-Sent Events (data: frames ending with data: [DONE]); stream_options: {"include_usage": true} adds a final usage frame. Non-streaming calls are cut off at about 290 seconds, so stream long generations.
Does Qwen3.8-Max support tool calling or JSON mode?
Qwen3.8-Max supports function calling via an OpenAI-format tools array with tool_choice and JSON mode via response_format {"type": "json_object"}. Both are passed through to the model in the standard OpenAI chat completions shape, so existing client code works unchanged.
Can I send images to Qwen3.8-Max?
Yes. Send a multimodal user message whose content is an array of parts — {"type": "text", "text": "…"} plus {"type": "image_url", "image_url": {"url": "https://…"}} (a data: URL also works; the request body limit is 10 MB).
What happens if my ModelRunner balance runs out while calling Qwen3.8-Max?
The request is refused with HTTP 429 and an OpenAI-style error whose code is insufficient_quota — the convention OpenAI SDKs already understand — and nothing is charged. Top up in the dashboard and retry. (Disconnecting from a stream after output has started is not a refund — the platform finishes the upstream call and bills its exact usage.)
