Purchase and use MaxCompute model computing service

更新时间:
复制 MD 格式

To use models in MaxCompute for data processing or offline inference without managing your own GPU resources, purchase the MaxCompute model computing service to meet your model inference and performance requirements.

Supported regions and models

  • Supported regions: The model computing service is available only in the following regions.

    • Chinese mainland: China (Beijing), China (Shanghai), China (Hangzhou), China (Shenzhen), China (Ulanqab)

    • International: Singapore

  • Supported models

    Model

    Supported input

    Description

    qwen3.7-max

    Text input only

    The flagship model of the Qwen 3.7 series. It offers comprehensive upgrades in inference, code generation, and multilingual understanding, making it suitable for highly complex tasks.

    qwen3.7-plus

    Multimodal input supported

    A balanced model in the Qwen 3.7 series that balances performance and cost, suitable for enterprise-level scenarios such as long-text analysis and multi-turn conversations.

    qwen3-vl-embedding

    Multimodal input supported

    A Qwen multimodal embedding model. It creates vector representations from mixed image-text inputs and is suitable for cross-modal retrieval and image-text matching.

    text-embedding-v4

    Text input only

    A high-precision text embedding model suitable for tasks like semantic search, clustering, and similarity calculation.

    qwen3.6-plus

    Multimodal input supported

    A balanced model in the Qwen 3.6 series that balances performance and cost, suitable for general-purpose tasks such as conversation, summarization, and analysis.

    qwen3.6-flash

    Multimodal input supported

    A lightweight and high-speed model from the Qwen 3.6 series. Its fast response times and low costs make it ideal for high-concurrency, low-latency online services.

    deepseek-v4-pro

    Text input only

    The fourth-generation flagship inference model from DeepSeek. It excels at difficult tasks such as mathematics, coding, and complex logical reasoning.

    deepseek-v4-flash

    Text input only

    A fourth-generation lightweight model from DeepSeek. With fast, cost-effective inference, it is ideal for daily conversation and lightweight reasoning tasks.

    qwen3.5-397b-a17b

    Multimodal input supported

    A Mixture-of-Experts (MoE) model from the Qwen 3.5 series. It features efficient parameter activation, a vast knowledge base, and multi-step reasoning capabilities. It is designed for challenging logical deduction, full-stack code generation, and in-depth knowledge Q&A.

    qwen3-asr-flash

    Multimodal input supported

    A lightweight automatic speech recognition (ASR) model from the Qwen 3 series. Its low-latency, high-concurrency real-time transcription is ideal for audio processing scenarios such as meeting transcription, live subtitling, and voice-command recognition.

    qwen3-max (To be deprecated)

    Text input only

    A high-performance large language model from the Qwen series, suitable for complex inference and content generation.

Billing

For details, see Model Compute Fee (Token Fee).

Before you begin

You only need to activate the service once per region. After activation, the service is available by default to all projects in that region.

  1. Log in to the MaxCompute console and select a region in the upper-left corner.

  2. In the left-side navigation pane, choose Manage Configurations > Quotas .

  3. On the Quotas page, click New Quota.

    On the purchase page, for Product Type, select Model Computing Service.

  4. On the MaxCompute model computing service page, select a region, agree to the service agreement, and then activate the service.

  5. After the purchase is complete, return to the console. A Pay-as-you-go quota named ai_InferenceQuota appears on the Quota Management page.

Usage

Use in MaxFrame jobs

To use the MaxCompute model computing service, specify a supported model in a MaxFrame AI Function.

Example: Use the qwen3.6-plus multimodal model for image understanding

Sample code

import os

import pandas as pd
import maxframe.dataframe as md
from maxframe import new_session
from maxframe.config import options
from maxframe.learn.contrib.llm import ImageContentType
from maxframe.learn.utils import read_odps_model
from odps import ODPS

# Configure the execution engine: DPE first
options.dag.settings = {
    "engine_order": ["DPE", "MCSQL"],
}

# 1. Create an ODPS connection
o = ODPS(
    os.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"),
    os.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
    project="<your-project-name>",
    endpoint="<your-endpoint>",  # Example: https://service.cn-shanghai.maxcompute.aliyun.com/api
)

# 2. Configure the engine and create a session
# Note: Inference for Model Studio (Bailian) VL models runs on the DPE engine
# and is billed based on token consumption. No CU or GU provisioning needed.

# Create a MaxFrame session
session = new_session(o)
print(f"Session ID: {session.session_id}")
print(f"Logview: {session.get_logview_address()}")

# Load the VL model from the Model Studio (Bailian) public model set
image_llm = read_odps_model(
    "qwen3.6-plus", project="bigdata_public_modelset", odps_entry=o
)

## 4. Prepare image data from OSS

# Use the `oss://<endpoint>/<bucket>/<path>` format and pass your OSS access credentials through `storage_options`.
# OSS configuration
OSS_ENDPOINT = "oss-cn-shanghai-internal.aliyuncs.com"  # Replace with your OSS endpoint
OSS_BUCKET = "your-bucket"                              # Replace with your bucket name
OSS_PREFIX = "images"                                   # Replace with the image path prefix

storage_options = {
    "access_key_id": os.getenv("OSS_ACCESS_KEY_ID"),
    "access_key_secret": os.getenv("OSS_ACCESS_KEY_SECRET"),
}

# Construct a list of image URLs
image_urls = [
    f"oss://{OSS_ENDPOINT}/{OSS_BUCKET}/{OSS_PREFIX}/image{i}.jpg"
    for i in range(1, 9)
]

df = md.DataFrame({"image_url": image_urls})
df.execute()

## 5. Call the VL model for image understanding

# Pass the text prompt and OSS images to the model by using the `generate()` interface.

cp = image_llm.content_part

result_df = image_llm.generate(
    df,
    messages=[
        {
            "role": "user",
            "content": [
                cp.text("Describe this image in one sentence"),
                cp.image(
                    data=df.image_url,
                    type=ImageContentType.IMAGE_URL,
                    storage_options=storage_options,
                ),
            ],
        }
    ],
    simple_output=True,
    params={"max_tokens": 128},
)

## 6. Run the inference and view the results

# MaxFrame uses lazy execution. Call .execute() to trigger the actual computation.
result = result_df.execute()
print(result)

## 7. Clean up resources
session.destroy()
print("Session destroyed")

For more syntax details and examples, see MaxFrame AI Function.

Use in SQL jobs

To use the MaxCompute model computing service in a SQL job, specify a supported model in an AI Function. The following code provides an example:

SET odps.namespace.schema=true;

SELECT 
    prompt,
    AI_GENERATE(
        bigdata_public_modelset.default.`qwen3.7-max`,
        DEFAULT_VERSION,
        concat('Perform sentiment classification for the following review. The output must be exactly one of the following three options: Positive, Negative, Neutral. Review:', prompt)
    ) AS generated_text
FROM (
    VALUES 
        ('The weather is great today, and I''m in a good mood! It''s sunny and perfect for a walk.'),
        ('The weather is great today, and I''m in a good mood! It''s sunny.'),
        ('Technology is advancing rapidly, and AI is changing our lives.'),
        ('The prevention and control measures are excellent. Kudos to the healthcare workers!'),
        ('The quality of this product is very poor.')
) t (prompt);

For more syntax details and examples, see AI_GENERATE.