全部产品
Search
文档中心

Alibaba Cloud Model Studio:Kemampuan Matematika (Qwen-Math)

更新时间:Dec 19, 2025

Qwen-Math menyediakan kemampuan reasoning dan perhitungan matematika yang kuat, berserta langkah-langkah pemecahan masalah yang rinci untuk memudahkan pemahaman dan verifikasi.

Catatan

Dokumen ini hanya berlaku untuk wilayah China (Beijing). Untuk menggunakan model, gunakan Kunci API dari wilayah tersebut.

Model dan harga

Komersial

Model

Harga input

Harga output

Context window

Input maksimum

Output maksimum

Kuota gratis

(Catatan)

(Juta token)

(Token)

qwen-math-plus

$0,574

$1,721

4.096

3.072

3.072

Tidak ada kuota gratis

qwen-math-turbo

$0,287

$0,861

Snapshots seperti qwen-math-xxx-latest dan qwen-math-xxx-YYYY-MM-DD memiliki harga dan spesifikasi yang sama dengan versi qwen-math-xxx sebelumnya.
Kemampuan model: qwen-math-xxx = qwen-math-xxx-latest = qwen-math-xxx-2024-09-19

Open source

Model

Harga input

Harga output

Context window

Input maksimum

Output maksimum

Kuota gratis

(Catatan)

(Juta token)

(Tokens)

qwen2.5-math-72b-instruct

$0,574

$1,721

4.096

3.072

3.072

Tidak ada kuota gratis

qwen2.5-math-7b-instruct

$0,144

$0,287

qwen2.5-math-1.5b-instruct

Gratis untuk sementara waktu

Gratis untuk sementara waktu

Untuk informasi selengkapnya mengenai rate limit, lihat Rate limits.

Memulai

Anda harus memperoleh kunci API dan mengatur API key sebagai variabel lingkungan. Jika Anda menggunakan OpenAI SDK atau DashScope SDK untuk melakukan panggilan, Anda juga perlu menginstal SDK.

Kompatibel dengan OpenAI

Python

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"), # Jangan hard-code kredensial dalam kode Anda. Selalu gunakan variabel lingkungan atau layanan manajemen kunci.
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)
completion = client.chat.completions.create(
    model="qwen-math-plus",
    messages=[{'role': 'user', 'content': 'Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $'}])
print(completion.choices[0].message.content)

curl

curl --location "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
    "model": "qwen-math-plus",
    "messages": [
        {
            "role": "user", 
            "content": "Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $"
        }
    ]
}'

DashScope

Python

from http import HTTPStatus
import dashscope


def call_with_messages():
    messages = [
        {'role': 'user', 'content': 'Turunkan solusi universal untuk persamaan kuadrat $ Ax^2+Bx+C=0 $'}]
    response = dashscope.Generation.call(
        model='qwen-math-plus',
        messages=messages,
        # Atur result_format ke message.
        result_format='message',  
    )
    if response.status_code == HTTPStatus.OK:
        print(response)
    else:
        print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
            response.request_id, response.status_code,
            response.code, response.message
        ))


if __name__ == '__main__':
    call_with_messages()
    

Java

import java.util.Arrays;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.aigc.generation.GenerationParam;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;

public class Main {
    public static void callWithMessage()
            throws NoApiKeyException, ApiException, InputRequiredException {
        Generation gen = new Generation();
        Message userMsg = Message.builder().role(Role.USER.getValue()).content("Derive a universal solution for the quadratic equation $ Ax^2+Bx+C=0 $").build();
        GenerationParam param =GenerationParam.builder()
                .apiKey(System.getenv("DASHSCOPE_API_KEY"))
                .model("qwen-math-plus")
                .messages(Arrays.asList(userMsg))
                .resultFormat(GenerationParam.ResultFormat.MESSAGE)
                .build();
        GenerationResult result = gen.call(param);
        System.out.println(result);
    }


    public static void main(String[] args){
        try {
            callWithMessage();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
    }
}

curl

curl --location "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
    "model": "qwen-math-plus",
    "input":{
        "messages":[
            {
                "role": "user",
                "content": "Derive a universal solution for the quadratic equation $ Ax^2+Bx+C=0 $"
            }
        ]
    },
    "parameters": {
        "result_format": "message"
    }
}'
Anda juga dapat membuka Konsol Studio Model untuk mencoba model tersebut.

Rekomendasi

  1. Gunakan bahasa Inggris dan LaTeX: Qwen-Math dirancang untuk menangani soal matematika dalam bahasa Inggris. Untuk hasil terbaik, gunakan LaTeX untuk simbol dan rumus matematika dalam input Anda.

  2. Standarisasi output: Gunakan partial mode untuk kontrol presisi. Fitur ini memastikan output mengikuti awalan yang diberikan secara akurat, sehingga meningkatkan akurasi dan kendali atas hasilnya.

  3. Secara default, parameter temperature model diatur ke 0. Anda tidak perlu menggantinya.

  4. Dapatkan hasil dengan mudah: Secara default, Qwen-Math menempatkan hasil akhir di dalam blok \boxed{}.

    image

FAQ

Bagaimana cara menggunakan Qwen-Math untuk memecahkan soal matematika dalam gambar?

Qwen-Math tidak mendukung input berupa gambar.

  • Jika gambar berisi soal matematika sederhana, gunakan Qwen-VL atau QVQ.

  • Jika gambar berisi soal matematika kompleks, ekstrak teks dari gambar terlebih dahulu menggunakan Qwen-VL atau QVQ, lalu gunakan Qwen-Math untuk menyelesaikannya.

Untuk informasi selengkapnya tentang parameter input dan respons Qwen-Math, lihat referensi API Qwen.

Di mana saya dapat menemukan informasi detail mengenai kode error?

Jika panggilan gagal, lihat Pesan error untuk troubleshooting.