Skip to main content
Specialized models

Mathematical capabilities (Qwen-Math)

Qwen-Math models provide mathematical reasoning with detailed, verifiable step-by-step solutions.

This document applies only to the China (Beijing) region. To use the model, you must use an API key from the China (Beijing) region.

Models and pricing

Commercial Models

Model name

Input price

Output price

Context window

Max input

Max output

Free quota

(Note)

(per million tokens)

(tokens)

qwen-math-plus

$0.574

$1.721

4,096

3,072

3,072

No free quota is available.

qwen-math-turbo

$0.287

$0.861

For information about model rate limits, see rate limiting.

Quick start

Obtain an API key and export the API key as an environment variable. If you use the OpenAI SDK or DashScope SDK to make calls, install the SDK.
  • OpenAI compatible
  • DashScope
Python
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"), # For security, do not hard-code your API key. Use an environment variable or a secrets management service.
    # China (Beijing) region. The URL varies depending on the region.
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)
completion = client.chat.completions.create(
    model="qwen-math-plus",
    messages=[{'role': 'user', 'content': 'Derive a universal solution for the quadratic equation $ Ax^2+Bx+C=0 $'}])
print(completion.choices[0].message.content)
Try the model in the Model Studio console.

Recommendations

  1. Use English and LaTeX: Qwen-Math handles mathematical problems in English. Use LaTeX for symbols and formulas in your input.
  2. Control content output: Partial mode ensures the model output closely follows a given prefix, improving accuracy.
  3. The temperature parameter defaults to 0. Do not change this setting.
  4. Easily extract results: Qwen-Math outputs the final result in a \boxed{} block by default.
### Final Answer:
The universal solution for the quadratic equation $ Ax^2 + Bx + C = 0 $ is:
$$
\boxed{x = \frac{-B \pm \sqrt{B^2 - 4AC}}{2A}}
$$

Frequently asked questions

How do I solve math problems in images with Qwen-Math?

Qwen-Math does not support image recognition.

  • For simple math in images, use Qwen-VL or QVQ.

  • For complex math in images, extract the text with Qwen-VL or QVQ, then solve with Qwen-Math.

Qwen-Math input and output parameters are documented in the Qwen API Reference.

Where can I find error code details?

If the model call fails and returns an error message, see Error codes for resolution.

Token Plan
Statistics and Monitoring
Support