Skip to main content

Text Generation-Deployed Models

Publish a trained text model as an online API service.

Applicable scope

Deployed Models

  • China (Beijing)
  • Singapore
POST https://dashscope.aliyuncs.com/api/v1/deployments
Request domains vary by region: the Beijing region uses dashscope.aliyuncs.com, and the Singapore region uses dashscope-intl.aliyuncs.com; the Dedicated Workspace Host ({WorkspaceId}.{region}.maas.aliyuncs.com) is available in all regions. For the complete domain information of each region, see Regional endpoints.
For Windows CMD, replace $DASHSCOPE_API_KEY with %DASHSCOPE_API_KEY%; for PowerShell, replace it with $env:DASHSCOPE_API_KEY

Request parameters

Request headers

Parameter

Type

Required

Description

Content-Type

String

Yes

Fixed value: application/json.

Authorization

String

Yes

API Key authentication, in the format Bearer sk-xxxx.

Request body
Request body parameters vary depending on the deployment method (plan). The complete request body parameters and deployment examples for each billing method are as follows:
  • Billed by DTU dedicated computing power
  • By Model Unit
  • > After you run the following deployment command, the model deployment service starts billing immediately upon successful deployment, even if you have not called the model yet. We recommend that you confirm the billing rules of the service before running the deployment command.
Dedicated Throughput (DTU) uses upfront (monthly) billing. You purchase capacity based on input/output TPM and get dedicated GPU resources. It is the successor to Model Unit (MU) and the preferred option for new dedicated deployments. Before using it, enable the DTU feature in the console and apply for a resource quota. For more information, see Dedicated Throughput (DTU).
API requests for DTU deployments must use the maas.aliyuncs.com domain of the workspace where the deployment resides (for example, ws-vxxx.cn-beijing.maas.aliyuncs.com) and the API Key of that workspace; sku_code, template_code, and capacity ranges are queried through the deployable model list API with plan=dtu. For complete parameters and APIs such as scaling, rate limit modification, and model updates, see Model deployment API reference.

Parameter

Type

Required

Description

model_name

String

Yes

The name of the model to deploy, corresponding to the model ID in My Models. It can also be obtained from the output of the Create Training Task API.

plan

String

Yes

The deployment plan, which determines the billing method: dtu (DTU dedicated computing power), mu (Model Unit), cu (Computing Power Unit), lora (LoRA shared deployment, billed by token usage).

display_name

String

Yes

Display name of the service, up to 50 characters (other deployment methods use name).

suffix

String

No

Deployment identifier suffix, up to 24 characters; the generated full deployment identifier does not exceed 100 characters. Automatically generated if omitted.

sku_code

String

Yes

The prepaid SKU available for the current model, queried via the deployable model list API with plan=dtu.

template_code

String

Yes

The deployment template matching the model and SKU; obtained from the same query as sku_code.

charge_type

String

Yes

Billing method; for DTU, always set to pre_paid (upfront).

dtu_capacity

Object

Yes

The DTU capacity to purchase; you must provide both input_tpm and output_tpm. For purchase ranges and step rules, see Model deployment API reference.

dtu_capacity.input_tpm

Integer

Yes

The purchased input TPM (tokens/min); a non-negative integer with a maximum of 2147483647, and must be an integer multiple of the step obtained from the query.

dtu_capacity.output_tpm

Integer

Yes

The purchased output TPM (tokens/min); a non-negative integer with a maximum of 2147483647, and must use the same multiple as the input TPM.

pre_paid_info

Object

Yes

Upfront purchase and auto-renewal settings. Contains the fields: pricing_cycle (always set to Month), duration (purchase duration in months), auto_renewal (whether to enable auto-renewal), and auto_renewal_duration (renewal duration in months when auto-renewal is enabled).

curl "https://ws-vxxx.cn-beijing.maas.aliyuncs.com/api/v1/deployments" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model_name": "your-supported-model",
    "display_name": "业务模型服务",
    "suffix": "production",
    "plan": "dtu",
    "sku_code": "your-prepaid-sku",
    "template_code": "your-template",
    "charge_type": "pre_paid",
    "pre_paid_info": {
        "pricing_cycle": "Month",
        "duration": 1,
        "auto_renewal": false
    },
    "dtu_capacity": {"input_tpm": 10000, "output_tpm": 10000}
}'

Deployment troubleshooting and performance tuning

The max-num-seqs parameter is not configurable

Model Studio model deployment uses either throughput reservation (a separate product; see its API documentation) or By Model Unit billing. Under both billing methods, throughput, concurrency, and generation speed are preset by the platform. Directly adjusting vLLM inference engine parameters such as max-num-seqs is not supported, and this parameter does not exist in the request parameters of this API. Under the By Model Unit billing method, you can indirectly control throughput by selecting the Model Unit Type (corresponding to the request parameter template_id) and adjusting Deployed Replicas (corresponding to the request parameter capacity).

Deployment templates and resource isolation

The current deployment template only supports single-node deployment (single-node deployment with enhanced general-purpose inference); multi-card instance isolation is not supported. If you need resource isolation, use the By Model Unit billing method, under which the computing resources are dedicated to your business.

Throttling error handling

When concurrent requests exceed the throttling threshold, the API returns HTTP 429, with the error code Throttling.RateQuota and the error message Requests rate limit exceeded, please try again later. Remedies:
  • Throughput reservation (a separate product; see its API documentation): adjust input_tpm and output_tpm in ptu_capacity (corresponding to Input kTPM and Output kTPM in the console), or reduce the request rate. Under this method, you can choose either auto overflow (switching to pay-as-you-go) or reserved capacity only (requests exceeding the capacity directly return 429) as the overflow strategy.
  • By Model Unit: adjust rpm_limit and tpm_limit, or reduce the request rate.

Context length tuning

Under the By Model Unit billing method, you can configure the Context Window with the request parameter max_context_length, whose value ranges from 1 to 262144 (the actual upper limit depends on the capability of the deployed model). This parameter limits the context size of a single request, thereby limiting the memory usage per request and reducing the risk of OOM. When processing tasks with a large number of images, set this parameter based on the image size and the number of images per request.

Response parameters

Parameter

Type

Description

request_id

String

The unique identifier of the request.

output

Object

Task details.

output.deployed_model

String

The unique identifier of the deployed model. Used to query the model deployment status and invoke the model.

output.name

String

The display name of the deployment.

output.model_name

String

The model identifier name.

output.base_model

String

The base model used.

output.status

String

Deployment status: PENDING (creating), DEPLOYING (deploying), WAIT_PRE_PAID_BILLING_TO_DEPLOYING (creation is in the upfront order processing phase, DTU), WAIT_PRE_PAID_BILLING_TO_SCALING (scaling is in the upfront order processing phase, DTU), UPDATING (updating), RUNNING (running and able to process requests normally), SCALING (scaling), STOPPED (stopped, not billed), DELETING (deleting), FAILED (creation or update failed).

output.workspace_id

String

The workspace ID that the API Key belongs to. For more information, see Obtain Workspace ID.

output.charge_type

String

Billing mode: post_paid (pay-as-you-go), pre_paid (upfront).

output.creator

String

The Alibaba Cloud account ID of the creator.

output.modifier

String

The Alibaba Cloud account ID of the modifier.

output.plan

String

The deployment method.

output.gmt_create

String

The time when the deployment task was created.

output.gmt_modified

String

The time when the deployment task was updated.

Returned only for the model unit (mu) deployment method.

output.base_capacity

Number

The minimum number of resource units required to run the base model.

output.ready_capacity

Number

The number of resource units that are ready and can process requests immediately.

output.capacity

Number

The number of resource units used by the deployment.

output.model_unit_spec

String

The model unit specification.

output.enable_thinking

Boolean

Whether thinking mode is enabled.

output.max_context_length

Number

The maximum context length limit.

output.rpm_limit

Number

Requests per minute.

output.tpm_limit

Number

Token usage per minute.

Returned only for the provisioned throughput (ptu_v2) deployment method

output.ptu_capacity

Object

Provisioned throughput configuration, including input_tpm (maximum input tokens per minute) and output_tpm (maximum output tokens per minute); some models also support thinking_output_tpm (maximum output tokens for provisioned thinking).

Returned only for the DTU (dtu) deployment method

output.dtu_capacity

Object

The purchased input/output TPM capacity, including input_tpm and output_tpm.

output.pre_paid_info

Object

Upfront payment and auto-renewal information.

For a complete list of DTU response fields, see Model deployment API reference

Returned when the call fails

code

String

Error code. Returned when the call fails.

message

String

Description of the error details. Returned when the call fails.

  • The detailed error description. Returned when the invocation fails.
  • Error response example
Pay special attention to: output.deployed_model (the unique identifier of the deployed model) and output.status (the deployment status).
{
    "request_id": "f2ae64f7-83cc-410c-bc0b-840443f7eb86",
    "output": {
        "deployed_model": "qwen-plus-2025-12-01-mu-xxxx",
        "gmt_create": "2025-06-17T11:00:38.68",
        "gmt_modified": "2025-06-17T11:00:38.68",
        "status": "PENDING",
        "model_name": "qwen-plus-2025-12-01",
        "base_model": "qwen-plus",
        "model_unit_spec": "MU1",
        "enable_thinking": true,
        "max_context_length": 10000,
        "rpm_limit": 500,
        "tpm_limit": 1000,
        "base_capacity": 1,
        "ready_capacity": 0,
        "workspace_id": "llm-v71tlv3d***",
        "charge_type": "post_paid",
        "creator": "175805416***",
        "modifier": "175805416***",
        "plan": "mu"
    }
}

Next steps

Deployment is an asynchronous operation. After calling this API, you can query the deployment status via the Query and manage deployments API.