Qwen3开源模型
复制成功!
立即体验加入对比
推理文本生成
概述
推理文本生成
基于Qwen3的思考模式开源模型,相较上一版本(千问3-235B-A22B)逻辑能力、通用能力、知识增强及创作能力均有大幅提升,适用于高难度强推理场景。
输入
文本
输出
文本
功能
定价
- 输入(思考)¥2/M tokens
- 输出(思考)¥20/M tokens
速率限制与上下文
- RPM每分钟请求数600
- TPM每分钟 Token 数1M
- 最大输入(思考模式)126.97K
- 最大输出(思考模式)32.76K
- 上下文131.07K
API 参考
获取 API Key复制成功!
12345678910111213141516171819202122232425262728293031323334353637
import os
from dashscope import Generation
import dashscope
dashscope.base_http_api_url = "https://dashscope.aliyuncs.com/api/v1/"
messages = [{"role": "user", "content": "你是谁?"}]
completion = Generation.call(
api_key=os.getenv("DASHSCOPE_API_KEY"),
model="qwen3-235b-a22b-thinking-2507",
messages=messages,
result_format="message",
stream=True,
incremental_output=True,
)
is_answering = False
print("=" * 20 + "思考过程" + "=" * 20)
for chunk in completion:
if (
chunk.output.choices[0].message.content == ""
and chunk.output.choices[0].message.reasoning_content == ""
):
pass
else:
if (
chunk.output.choices[0].message.reasoning_content != ""
and chunk.output.choices[0].message.content == ""
):
print(chunk.output.choices[0].message.reasoning_content, end="", flush=True)
elif chunk.output.choices[0].message.content != "":
if not is_answering:
print("\n" + "=" * 20 + "完整回复" + "=" * 20)
is_answering = True
print(chunk.output.choices[0].message.content, end="", flush=True)