Qwen4-Open-Source
NEWCopy success!
Try AIAdd to Compare
Overview
Qwen4-35B-A3B is the open-source version from the latest flagship series of the Qwen (Tongyi Qianwen) family, released in December 2026. It utilizes a sparse Mixture-of-Experts (MoE) architecture with a total of 35 billion parameters—of which approximately 3 billion are activated per step—and supports a context window of 1 million tokens.
Input
TextImageVideo
Output
Text
Features
Cache
Context Cache caches the prefix of long-context requests, reducing redundant computation during inference. This improves response speed and lowers your usage costs.View docsFunction Calling
You can use Function Calling to enable the models to interact with the external world by integrating tools.View docsPrefix Completion
You can use partial mode when calling the Qwen API to ensure the model strictly generates text based on your provided initial content.View docsStructured Output
Use structured output to ensure that the model outputs standard JSON strings.View docsWeb Search
When web search is enabled, the model will respond based on retrieved real-time data.View docsPricing
- Input$0.06Per 1M tokens
- Output$0.36Per 1M tokens
- Input(Implicit Cache)$0.003Per 1M tokens
- 5-Minute Explicit Cache Creation$0.075Per 1M tokens
- 1-Hour Explicit Cache Creation$0.12Per 1M tokens
- Explicit Cache Read$0.003Per 1M tokens
Rate Limits & Context
- Max Input991K
- Max Output128K
- Max Input (Thinking)983K
- Max Output (Thinking)256K
- Context1M
- Max Reasoning256K
- TPMTokens Per Minute5000000
Built-in Tools
code_interpreterResponses API
i2i_searchResponses API
t2i_searchResponses API
pdf_parsingCompletions API
pdf_parsingAnthropic API
pdf_parsingResponses API
API Reference
Call APICopy success!
123456789101112131415161718192021222324252627282930
from openai import OpenAI
import os
client = OpenAI(
# If the environment variable is not set, replace it with your Model Studio API key: api_key="sk-xxx"
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1",
)
messages = [{"role": "user", "content": "Who are you"}]
completion = client.chat.completions.create(
model="qwen4-35b-a3b", # You can replace this with another deep thinking models
messages=messages,
extra_body={"enable_thinking": True},
stream=True
)
is_answering = False # Indicates whether the response phase has started
print("\n" + "=" * 20 + "Thinking process" + "=" * 20)
for chunk in completion:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
if not is_answering:
print(delta.reasoning_content, end="", flush=True)
if hasattr(delta, "content") and delta.content:
if not is_answering:
print("\n" + "=" * 20 + "Full response" + "=" * 20)
is_answering = True
print(delta.content, end="", flush=True)123456789101112131415161718192021222324252627282930
from openai import OpenAI
import os
client = OpenAI(
# If the environment variable is not set, replace it with your Model Studio API key: api_key="sk-xxx"
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1",
)
messages = [{"role": "user", "content": "Who are you"}]
completion = client.chat.completions.create(
model="qwen4-35b-a3b", # You can replace this with another deep thinking models
messages=messages,
extra_body={"enable_thinking": True},
stream=True
)
is_answering = False # Indicates whether the response phase has started
print("\n" + "=" * 20 + "Thinking process" + "=" * 20)
for chunk in completion:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
if not is_answering:
print(delta.reasoning_content, end="", flush=True)
if hasattr(delta, "content") and delta.content:
if not is_answering:
print("\n" + "=" * 20 + "Full response" + "=" * 20)
is_answering = True
print(delta.content, end="", flush=True)