Skip to main content

Throughput Reservation API Reference

The throughput reservation API is used to create, query, and manage throughput reservation capacity. Each throughput reservation is identified by a dedicated model code and can contain multiple capacity instances; each instance corresponds to one capacity purchase and can be scaled, renewed, or released individually.

nodeAPIFor more information, see
Create a throughput reservationPOST /api/v1/deploymentsCreate a throughput reservation
Query reservation detailsGET /api/v1/deployments/{deployed_model}Query throughput reservation details
Query the reservation listGET /api/v1/deploymentsQuery throughput reservation list
Purchase an additional capacity instancePOST /api/v1/deployments/{deployed_model}/capacity-instancesPurchase an additional capacity instance
Scale capacity instancesPUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/scaleScale capacity instances
Renew capacity instancesPUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/renewRenew capacity instances
Enable / Disable auto-renewalPUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/auto-renewSet auto-renewal
Unsubscribe from / release capacity instancesDELETE /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}Delete capacity instance
Modify the overflow strategyPUT /api/v1/deployments/{deployed_model}/update-overflowstrategyModify the overflow strategy
Delete a throughput reservationDELETE /api/v1/deployments/{deployed_model}Delete throughput reservation
Query the capacity instance listGET .../capacity-instancesQuery capacity instance list
Query capacity operation statusGET .../operations/{id}Query capacity operation status
Error codes—Error codes

Authentication and API call preparation

Use the Model Studio API Key of the region you are calling and pass it in the request header as Authorization: Bearer <api-key>. An API Key is bound to its region and cannot be used across regions. If the request body is JSON, pass Content-Type: application/json. The workspace-dedicated domain format is https://{workspaceId}.{region}.maas.aliyuncs.com; use the Endpoint of the target workspace and region. To specify a sub-workspace, set the request header X-DashScope-WorkSpace: <workspace-id>。 The DashScope API domain is https://dashscope.aliyuncs.com. The Virginia region uses https://{workspaceId}.us-east-1.maas.aliyuncs.com. For the console entry, see Throughput reservation; for deployment concepts, see Model deployment; for general deployment APIs, see Deploy models by using APIs.

General rules

The API base path is /api/v1/deployments, which follows the DashScope OpenAPI domain and authentication method of the region you are calling. Requests use Content-Type: application/json. Use the account, model, and deployment of the target region.
  • deployed_model: the dedicated model code of the throughput reservation (the calling identity); model_service_id in instance and operation responses refers to the same object.
  • instance_id: the capacity instance ID. Use the value returned by the API; do not infer the billing method from the string format.
  • operation_id: the operation ID. Use the string value returned by the API.
  • The example IDs, model names, and capacity values below are placeholders. Actual models, minimum values, steps, upper limits, and purchase durations are subject to the models and purchase restrictions of the target region.
  • JSON examples omit some optional response fields; the phase statuses in the examples are not fixed returns for every request.
Successful responses are wrapped in a unified structure:
{
  "request_id": "example-request",
  "output": {}
}
Request error example:
{
  "request_id": "example-request",
  "code": "CAPACITY_INSTANCE_REQUIRED",
  "message": "需要指定容量实例"
}
A successful HTTP request does not mean a successful capacity operation. Even if an instance write API returns HTTP 200, output.operation_status may still be FAILED. Always check the operation status and error fields, and use the updated capacity only after confirming success.
The result of an asynchronous capacity operation is obtained via Query capacity operation.
  1. Query instance details to check capability switches and the latest configuration.
  2. Initiate a purchase / scaling / renewal / deletion request and save the operation_id.
  3. If PROCESSING is returned, poll the operation periodically with gradual backoff; if it is already in a final state, handle the result directly.
  4. After SUCCEEDED, refresh the instance and the dedicated model code; if FAILED, show error_code / error_message. A network timeout does not mean the operation failed; check existing operations first.
Capacity changes for the same dedicated model code are processed sequentially; while an operation is in progress, new changes may be rejected. Accepted unsubscribe and release requests are queued and proceed after preceding operations complete. Before a change takes effect, queries still return the previously effective capacity; do not treat the target capacity as already in effect. After an additional purchase, scaling, or release takes effect, you can obtain the updated aggregate effective capacity through the deployment query API and continue using the original dedicated model code. Calling a model also requires completing the corresponding model deployment and using correct account authentication and call parameters; a successful capacity operation does not mean all other conditions for model calls are met.

Create a throughput reservation

POST /api/v1/deployments Creates a throughput reservation and purchases the first capacity instance, returning the dedicated model code used to call the model. To add capacity to an existing throughput reservation, call Purchase an additional capacity instance.
FieldTypeRequiredDescription
model_nameStringYesBase model name
planStringYesptu
service_tierStringNoPerformance tier: ptu_fast for high-speed (default), ptu_default for standard mode. When pricing_cycle is Hour, you must explicitly pass ptu_default; if omitted, the request will be treated as the default high-speed tier and rejected
charge_typeStringYespre_paid (upfront) / post_paid (Pay-as-you-go)
nameStringNoDisplay name; automatically generated if not specified.
suffixStringNoSuffix of the dedicated model code; automatically generated if not specified.
ptu_capacityObjectYesCapacity configuration. For more information, see capacity parameters
pre_paid_infoObjectConditionally requiredRequired for upfront payment. For more information, see upfront parameters; not passed for Pay-as-you-go
overflow_strategyStringNoOverflow policy: enable means overflow usage is billed on a pay-as-you-go basis, while disable means requests are throttled once the capacity is exceeded; set at creation
ptu_default supports upfront payment; ptu_fast supports both upfront and Pay-as-you-go. New capacity instances inherit the performance tier of the dedicated model code. ptu_default standard mode supports two billing cycles: by day and 8-hour slots. By day corresponds to pricing_cycle=Day, and the 8-hour slot corresponds to pricing_cycle=Hour with duration=8. The 8-hour slot is supported only by ptu_default standard mode; ptu_fast high-speed does not support it. The 8-hour service slot must fall entirely within the daily 22:00–08:00 selling window, so orders can be placed only from 22:00 on the current day to 00:00 the next day (for billing rules, see throughput reservation billing). An 8-hour slot can be created through this API (pass pricing_cycle=Hour and duration=8) or added to an existing reservation through stacked capacity instance purchase. By-day upfront payment example:
{
  "model_name": "<base_model>",
  "plan": "ptu",
  "service_tier": "ptu_fast",
  "charge_type": "pre_paid",
  "name": "吞吐预留示例",
  "ptu_capacity": {
    "input_tpm": 10000,
    "output_tpm": 1000
  },
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": false
  }
}
curl request example:
curl -X POST "https://dashscope.aliyuncs.com/api/v1/deployments" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "model_name": "<base_model>",
    "plan": "ptu",
    "service_tier": "ptu_fast",
    "charge_type": "pre_paid",
    "name": "吞吐预留示例",
    "ptu_capacity": {
        "input_tpm": 10000,
        "output_tpm": 1000
    },
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": false
    }
}'
8-hour slot upfront payment example (ptu_default standard mode only):
{
  "model_name": "<base_model>",
  "plan": "ptu",
  "service_tier": "ptu_default",
  "charge_type": "pre_paid",
  "ptu_capacity": {
    "input_tpm": 10000,
    "output_tpm": 1000
  },
  "pre_paid_info": {
    "pricing_cycle": "Hour",
    "duration": 8,
    "auto_renewal": false
  }
}

ptu_capacity

Capacity is measured in kTPM (1 kTPM = 1000 Tokens per minute).
FieldTypeDescription
input_tpmLongInput capacity, in kTPM; starting from 200 kTPM in increments of 10 kTPM
output_tpmLongOutput capacity, in kTPM; starting from 20 kTPM in increments of 1 kTPM
thinking_output_tpmLongThinking output capacity; this dimension is supported only by some models
When scaling, this indicates the absolute capacity of the selected instance after the change, not the increment, nor the target total capacity of the dedicated model code.

pre_paid_info

FieldTypeDescription
pricing_cycleStringBilling cycle: Day for by day (default), Hour for the 8-hour slot; Hour is supported only by ptu_default standard mode; case-sensitive
durationIntegerPurchase / renewal duration, with the unit following pricing_cycle: days for Day, hours for Hour and fixed at 8; must be greater than 0
auto_renewalBooleanExplicitly specifies whether to enable auto-renewal; must be false in the Hour scenario
auto_renewal_durationIntegerRequired and greater than 0 when auto-renewal is enabled, in days; not passed in the Hour scenario
auto_renewal_cycleStringOptional renewal cycle unit; pass a value supported by the product, for example Day for days; not passed in the Hour scenario

Create response

output is the deployment object (Query throughput reservations). When creating a capacity instance, operation_id and instance_id may be returned; if the purchase order of an upfront instance has not been fully processed yet, instance_id may be temporarily absent and can be obtained through subsequent queries.
{
  "request_id": "example-request",
  "output": {
    "deployed_model": "example-model-code",
    "model_name": "<base_model>",
    "plan": "ptu",
    "status": "WAIT_PRE_PAID_BILLING_TO_DEPLOYING",
    "operation_id": "100001"
  }
}
If operation_id is present, query it via Query capacity operations; if the creation request times out, first confirm whether it has already been created to avoid creating duplicate dedicated model codes.

Query API

Query throughput reservation details

GET /api/v1/deployments/{deployed_model} Query the configuration and status of a specified throughput reservation, as well as the effective aggregated capacity of all capacity instances. curl request example:
curl -X GET "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
{
  "request_id": "example-request",
  "output": {
    "deployed_model": "example-model-code",
    "model_name": "<base_model>",
    "plan": "ptu",
    "ptu_service_tier": "ptu_fast",
    "status": "RUNNING",
    "charge_type": "pre_paid",
    "ptu_capacity": {
      "input_tpm": 10000,
      "output_tpm": 1000
    },
    "overflow_strategy": "disable"
  }
}
FieldDescription
deployed_modelThe invocation identity of the throughput reservation (dedicated model code).
model_nameThe base model name.
planThe type identity, which is ptu for throughput reservations.
statusThe status of the dedicated model code, which does not represent the status of each capacity instance
ptu_service_tierPerformance tier: ptu_fast indicates high speed, and ptu_default indicates standard mode
ptu_capacityThe effective aggregated input and output capacity of all capacity instances under this dedicated model code
charge_typeValues: pre_paid (upfront) / post_paid (pay-as-you-go)
pre_paid_infoThe upfront purchase and renewal configuration, including pricing_cycle (Day by day / Hour as an 8-hour period), duration, and more. When multiple capacity instances exist, query the pre_paid_info of the target instance through instance details.
pre_paid_instance_idThe upfront instance identity. When multiple capacity instances exist, obtain the instance_id of each instance from the capacity instance list and specify the instance to operate on.
pre_paid_gmt_expiredThe upfront expiration time. When multiple capacity instances exist, obtain the expiration time from the gmt_expired field in the target instance details. For the expiration time calculation rules, see TPM reservation billing.
overflow_strategyThe overflow policy: enable indicates that overflow usage is billed on a pay-as-you-go basis, and disable indicates that requests are rate-limited once the capacity is exceeded. For overflow billing rules, see TPM reservation billing.
fail_reasonThe failure reason.
gmt_createThe creation time.
gmt_modifiedThe last modification time.
operation_idThe capacity operation ID, used to query operation results; it may be returned in the response of the corresponding write operation.
instance_idThe capacity instance ID. It may not be returned while the purchase order is still being processed; obtain it through subsequent queries.
Hybrid billing should be determined by the charge_type of each instance in the capacity instance list. The deployment status and billing type cannot replace the status and billing type of each instance.

Query the throughput reservation list

GET /api/v1/deployments?page_no=1&page_size=10&plan=ptu Query the throughput reservation list with pagination. curl request example:
curl -X GET "https://dashscope.aliyuncs.com/api/v1/deployments?page_no=1&page_size=10&plan=ptu" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
Query parametersDescription
page_noPage number. Default: 1
page_sizeNumber of entries per page. Default: 10. Range: [1,100]
planOptional type filter. Pass ptu when querying throughput reservations; the performance tier is indicated by service_tier and is not a value of plan
{
  "request_id": "example-request",
  "output": {
    "deployments": [
      {
        "deployed_model": "example-model-code",
        "plan": "ptu",
        "status": "RUNNING",
        "ptu_capacity": {
          "input_tpm": 10000,
          "output_tpm": 1000
        }
      }
    ],
    "total": 1,
    "page_no": 1,
    "page_size": 10
  }
}
The deployment list does not support filtering by status with the status parameter. To filter capacity instances, use the statuses parameter of Query the capacity instance list (including deleted instances).

Query the capacity instance list

GET /api/v1/deployments/{deployed_model}/capacity-instances?page_no=1&page_size=20&include_deleted=true curl request example:
curl -X GET "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances?page_no=1&page_size=20&include_deleted=true" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
Query parametersTypeDescription
page_noIntegerDefault: 1
page_sizeIntegerDefault: 20. Range: [1,100]
include_deletedBooleanDefault: true; explicitly pass false to show only instances that have not been deleted
statusesString listOptional. Multiple values separated by commas, for example RUNNING,STOPPED
charge_typesString listOptional, pre_paid,post_paid
nameThe reservation name.
base_modelThe base model name.
base_capacityThe currently effective capacity.
workspace_idThe workspace ID.
creatorThe creator.
modifierThe last modifier.
{
  "request_id": "example-request",
  "output": {
    "records": [
      {
        "model_service_id": "example-model-code",
        "instance_id": "example-capacity-instance",
        "charge_type": "post_paid",
        "status": "STOPPED",
        "deleted": true,
        "effective_capacity": {
          "input_tpm": 0,
          "output_tpm": 0
        },
        "configured_capacity": {
          "input_tpm": 0,
          "output_tpm": 0
        },
        "can_scale": false,
        "can_renew": false,
        "can_delete": false
      }
    ],
    "items": 1,
    "page": 1,
    "itemsPerPage": 20,
    "pageCount": 1
  }
}
The pagination structure differs from the deployment list: records is the current page, items is the total count, page is the page number, and the field names itemsPerPage / pageCount are subject to the actual API response. Instances with effective capacity are listed first, then sorted by creation time in descending order. The list only supports the query parameters listed in this section.

Query capacity instance details

GET /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id} Returns the instance object of the capacity instance; deleted instances can also be queried. The dedicated model code must match the instance; you cannot operate on an instance across a different dedicated model code. curl request example:
curl -X GET "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
After a pay-as-you-go instance is released, purchasing pay-as-you-go capacity again under the same dedicated model code reuses the original instance ID. The list and details are updated with the information of the newly purchased instance, and the original deletion record is no longer kept separately. The configured_capacity after release may be zero; the configured capacity before release is not guaranteed to be retained.

Query capacity operation status

GET /api/v1/deployments/{deployed_model}/capacity-operations/{operation_id} curl request example:
curl -X GET "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-operations/{operation_id}" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
{
  "request_id": "example-poll-request",
  "output": {
    "operation_id": "100001",
    "request_id": "example-original-request",
    "operation_type": "SCALE",
    "operation_status": "SUCCEEDED",
    "model_service_id": "example-model-code",
    "instance_id": "example-capacity-instance",
    "from_status": "RUNNING",
    "current_status": "RUNNING"
  }
}
The outer request_id is the identifier of this query request, while the request_id in the operation object is the identifier of the original operation; the two may differ. The query path must belong to the dedicated model code that created the operation. Use the operation_id actually returned by the write operation; do not construct one yourself. When you query a nonexistent numeric ID or an operation of another dedicated model code, HTTP 404 and CAPACITY_OPERATION_NOT_FOUND are returned; an invalid operation ID may return InternalError. Verify the ID first and then retry.

Capacity management APIs

The following APIs all use /api/v1/deployments/{deployed_model} as the prefix.

Purchase additional capacity instances

POST /api/v1/deployments/{deployed_model}/capacity-instances
FieldRequiredDescription
billing_methodYesBilling method: PRE_PAY for upfront and POST_PAY for pay-as-you-go. Values are case-sensitive
ptu_capacityYesNew instance capacity
pre_paid_infoConditionally requiredRequired for upfront and not passed for pay-as-you-go
Upfront example:
{
  "billing_method": "PRE_PAY",
  "ptu_capacity": {
    "input_tpm": 10000,
    "output_tpm": 1000
  },
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": false
  }
}
curl request example:
curl -X POST "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "billing_method": "PRE_PAY",
    "ptu_capacity": {
        "input_tpm": 10000,
        "output_tpm": 1000
    },
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": false
    }
}'
Example of purchasing an 8-hour window increment (only for the ptu_default standard mode, with billing_method fixed to PRE_PAY and pre_paid_info passing pricing_cycle=Hour / duration=8 / auto_renewal=false):
{
  "billing_method": "PRE_PAY",
  "ptu_capacity": {
    "input_tpm": 10000,
    "output_tpm": 1000
  },
  "pre_paid_info": {
    "pricing_cycle": "Hour",
    "duration": 8,
    "auto_renewal": false
  }
}
curl request example:
curl -X POST "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "billing_method": "PRE_PAY",
    "ptu_capacity": {
        "input_tpm": 10000,
        "output_tpm": 1000
    },
    "pre_paid_info": {
        "pricing_cycle": "Hour",
        "duration": 8,
        "auto_renewal": false
    }
}'
The 8-hour service window must fall entirely within the daily 22:00–08:00 sales window, so orders can be placed only from 22:00 on the current day to 00:00 the next day (for billing rules, see Throughput reservation billing). After an 8-hour window instance is created successfully, you can obtain the following fields via Query capacity instance details: pricing_cycle is Hour; gmt_effective is the effective time at a whole hour in Beijing time; gmt_expired is 8 hours later than gmt_effective; and can_scale, can_renew, can_enable_auto_renew, can_disable_auto_renew, and can_delete are all false. Pay-as-you-go example:
{
  "billing_method": "POST_PAY",
  "ptu_capacity": {
    "input_tpm": 10000,
    "output_tpm": 1000
  }
}
curl request example:
curl -X POST "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "billing_method": "POST_PAY",
    "ptu_capacity": {
        "input_tpm": 10000,
        "output_tpm": 1000
    }
}'
Returns an operation object; the initial response may already be successful, failed, or still processing. The existing dedicated model code, model, and performance tier are reused; only one non-deleted pay-as-you-go instance is allowed per dedicated model code. If the purchase conditions or the number of instances do not meet the requirements, handle the error based on the API response.

Scale capacity instances

PUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/scale
{
  "ptu_capacity": {
    "input_tpm": 20000,
    "output_tpm": 2000
  },
  "order_type": "UPGRADE"
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/scale" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "ptu_capacity": {
        "input_tpm": 20000,
        "output_tpm": 2000
    },
    "order_type": "UPGRADE"
}'
The parameter semantics are the same as those of Scaling; the instance ID is determined by the path and does not need to be repeated in the request body. Returns an operation object. Query can_scale before calling; an upfront instance suspended due to expiration cannot be scaled directly and should be renewed first. 8-hour window instances do not support scaling; the call returns CAPACITY_INSTANCE_OPERATION_UNSUPPORTED.

Renew a Capacity Instance

PUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/renew Standard renewal:
{
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": false
  }
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/renew" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": false
    }
}'
Renew and adjust capacity:
{
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": false
  },
  "is_change": true,
  "ptu_capacity": {
    "input_tpm": 20000,
    "output_tpm": 2000
  }
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/renew" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": false
    },
    "is_change": true,
    "ptu_capacity": {
        "input_tpm": 20000,
        "output_tpm": 2000
    }
}'
Parameter constraints are the same as Renew, without passing order_type. Only upfront instances can be renewed; check can_renew first. Returns an operation object. 8-hour time-slot instances do not support renewal or auto-renewal; the call returns CAPACITY_INSTANCE_OPERATION_UNSUPPORTED.

Configure Auto-Renewal

PUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/auto-renew Enable auto-renewal:
{
  "auto_renewal": true,
  "auto_renewal_cycle": "Day",
  "auto_renewal_duration": 7
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/auto-renew" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "auto_renewal": true,
    "auto_renewal_cycle": "Day",
    "auto_renewal_duration": 7
}'
FieldTypeRequiredDescription
auto_renewalBooleanYesWhether to enable auto-renewal
auto_renewal_cycleStringYesBilling cycle; must be Day. Passing other values returns InvalidParameter
auto_renewal_durationIntegerYesNumber of days purchased per auto-renewal, a positive integer
Returns a capacity operation object (operation_type is AUTO_RENEW, usually completed synchronously with status SUCCEEDED). Before calling, query the instance's can_enable_auto_renew / can_disable_auto_renew to determine whether enabling or disabling is currently allowed; to disable auto-renewal, pass "auto_renewal": false. 8-hour time-slot instances do not support auto-renewal.

Delete a Capacity Instance

DELETE /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id} The optional query parameter reason is the deletion reason, URL-encoded; no JSON request body is required. Returns an operation object. curl request example:
curl -X DELETE "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}?reason=release" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
  • Pay-as-you-go: released via the deletion process; when complete, deleted=true and status=STOPPED, with effective capacity of zero.
  • Active upfront instances: this API cannot replace unsubscription; calling it directly returns PREPAID_UNSUBSCRIBE_REQUIRED. After unsubscribing and releasing the capacity, it likewise ends with deleted=true and status=STOPPED.
  • 8-hour time-slot instances do not support deletion or unsubscription; the capacity automatically expires when the time slot ends; the call returns PREPAID_UNSUBSCRIBE_REQUIRED.
  • can_delete=true indicates that the current state allows entering the deletion / unsubscription process; it does not mean upfront instances can skip unsubscription and directly DELETE. For failed instances that have no associated order yet, handle them based on the API response.
Unsubscribe-and-release is an asynchronous operation. When the same dedicated model code is processing other operations, an accepted release operation queues and waits; queries before completion may still return the original status and effective capacity. An accepted unsubscription does not mean the capacity has been released; confirm completion via the operation result and the instance's deleted field. For more information about the unsubscription refund formula, see Throughput Reservation Billing.

Modify the Overflow Strategy

PUT /api/v1/deployments/{deployed_model}/update-overflowstrategy
{
  "overflow_strategy": "disable"
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/update-overflowstrategy" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "overflow_strategy": "disable"
}'
overflow_strategy is required and only supports lowercase enable / disable. enable means traffic exceeding the throughput reservation capacity is allowed to overflow to the public pool and is billed on a pay-as-you-go basis; disable means excess requests return a 429 rate-limit error (only reserved capacity is used). The configuration applies to the entire dedicated model code; capacity packages do not have a separate overflow strategy. For more information about overflow billing rules, see Throughput Reservation Billing. The response contains request_id and output. After the modification, you can call Query Throughput Reservation to get overflow_strategy and confirm the configuration has been updated.
{
  "request_id": "example-request",
  "output": {
    "deployed_model": "example-model-code",
    "model_name": "<base_model>",
    "plan": "ptu",
    "ptu_service_tier": "ptu_fast",
    "status": "RUNNING",
    "charge_type": "post_paid",
    "overflow_strategy": "disable",
    "ptu_capacity": {
      "input_tpm": 10000,
      "output_tpm": 1000
    }
  }
}
After the overflow strategy is enabled, traffic exceeding capacity is billed on a pay-as-you-go basis and incurs additional charges. After it is disabled, requests exceeding capacity are rate-limited. For more information about overflow billing rules, see Throughput Reservation Billing; for more information, see Long Input and Prefix Caching.
The following two APIs are legacy APIs retained for compatibility.

Scaling (Legacy API)

Legacy API; Scale a Capacity Instance is recommended instead. This API is retained for compatibility and returns a deployment object rather than a capacity operation object. PUT /api/v1/deployments/{deployed_model}/scale Adjusts the input and output capacity of a specified capacity instance under a throughput reservation. When multiple undeleted instances exist, the target instance must be specified via instance_id.
FieldRequiredDescription
instance_idConditionally requiredRequired when multiple undeleted instances exist; can be omitted when only one undeleted instance exists
ptu_capacityYesThe absolute capacity of the instance after the change
pre_paid_infoNoFor upfront, the saved information is reused when not passed; do not pass it for pay-as-you-go
order_typeNoUPGRADE means scale up and DOWNGRADE means scale down; if omitted, it is determined by the server, and the value passed must be consistent with the direction of the capacity change
{
  "instance_id": "example-capacity-instance",
  "ptu_capacity": {
    "input_tpm": 20000,
    "output_tpm": 2000
  },
  "order_type": "UPGRADE"
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/scale" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "instance_id": "example-capacity-instance",
    "ptu_capacity": {
        "input_tpm": 20000,
        "output_tpm": 2000
    },
    "order_type": "UPGRADE"
}'
output returns throughput reservation information, and the ID of the corresponding capacity operation is returned via operation_id. If multiple instances exist without a specified ID, CAPACITY_INSTANCE_REQUIRED is returned. For new integrations, Scale a Capacity Instance is recommended. Upfront changes involve orders; pay-as-you-go does not go through upfront change orders. Before the change is confirmed, the original effective capacity is retained; on failure, the target capacity must not be shown as effective. Scaling to all zero is not equivalent to deleting the instance.

Renew (Legacy API)

Legacy API; Renew a Capacity Instance is recommended instead. This API is retained for compatibility and returns a deployment object rather than a capacity operation object. PUT /api/v1/deployments/{deployed_model}/renew Renew a specified upfront capacity instance, with optional capacity adjustment. When there are multiple undeleted instances, the target instance must be specified via instance_id.
FieldRequiredDescription
instance_idConditionally requiredRequired when there are multiple undeleted instances; can be omitted for backward compatibility with a single instance
pre_paid_infoYesRenewal information. For more information, see Prepaid parameters
is_changeNoDefaults to false; whether to adjust the capacity at the same time
ptu_capacityNoIf omitted, the configured capacity is retained; if a different capacity is passed, is_change=true is required
Renew and enable auto-renewal:
{
  "instance_id": "example-capacity-instance",
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": true,
    "auto_renewal_duration": 30
  }
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/renew" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "instance_id": "example-capacity-instance",
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": true,
        "auto_renewal_duration": 30
    }
}'
Renew without enabling auto-renewal:
{
  "instance_id": "example-capacity-instance",
  "pre_paid_info": {
    "duration": 30,
    "auto_renewal": false
  }
}
curl request example:
curl -X PUT "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}/renew" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
    "instance_id": "example-capacity-instance",
    "pre_paid_info": {
        "duration": 30,
        "auto_renewal": false
    }
}'
Only upfront billing is supported; renewal requests must not pass order_type. output returns throughput reservation information and may contain a capacity operation ID; it is recommended to use the instance-level API Renew a capacity instance and poll the result.

Delete a throughput reservation

DELETE /api/v1/deployments/{deployed_model} All capacity instances must be released first, the dedicated model code must be STOPPED, and there must be no running or queued capacity operations before the entire deployment can be deleted. Returns the deployment object. curl request example:
curl -X DELETE "https://dashscope.aliyuncs.com/api/v1/deployments/{deployed_model}" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"
After the last instance is released, the dedicated model code becomes STOPPED, but it is not automatically deleted as a result. Deleting a capacity instance and deleting the dedicated model code are two distinct operations.

Response fields

Capacity instance (CapacityInstance)

FieldTypeDescription
model_service_idStringThe dedicated model code that the capacity instance or operation belongs to.
instance_idStringThe capacity instance ID.
charge_typeStringpre_paid (upfront) / post_paid (Pay-as-you-go)
statusStringThe instance lifecycle status. For more information, see the table below
deletedBooleanWhether the instance has been deleted / released, used to identify released instances
effective_capacityObjectThe capacity currently confirmed to be in service
configured_capacityObjectThe configured / contracted capacity of the instance; retained even when stopped or suspended
target_capacityObjectThe target capacity being changed to; may not be returned or may be empty in a stable state
pre_paid_infoObjectThe prepaid purchase and renewal configuration of this instance, including pricing_cycle (Day by day / Hour as an 8-hour period). For more information, see Prepaid parameters.
gmt_effectiveStringThe effective time of the prepaid instance; 8-hour-period instances take effect on the hour in Beijing time. Parse it using the time zone offset, and do not treat the hour value of +00:00 directly as Beijing time.
gmt_expiredStringThe expiration time of the prepaid instance; for 8-hour-period instances, it is 8 hours after gmt_effective. For the expiration time calculation rules, see Throughput reservation billing.
can_scaleBooleanWhether scaling is currently allowed on the instance; fixed to false for 8-hour-period instances.
can_renewBooleanWhether the instance can currently be renewed; fixed to false for 8-hour-period instances.
can_enable_auto_renewBooleanWhether auto-renewal can currently be enabled; fixed to false for 8-hour-period instances.
can_disable_auto_renewBooleanWhether auto-renewal can currently be disabled; fixed to false for 8-hour-period instances.
can_deleteBooleanWhether the instance can currently be deleted or unsubscribed; prepaid instances must still complete the unsubscription process, and it is fixed to false for 8-hour-period instances.
fail_reasonStringFailure reason
nameStringThe reservation name.
model_nameStringThe base model name.
planStringFixed to ptu.
ptu_capacityObjectCapacity Configuration (input_tpm / output_tpm).
ptu_service_tierStringReasoning Mode (ptu_default / ptu_fast).
overflow_strategyStringSpillover policy.
gmt_createTimeThe creation time.
gmt_modifiedTimeThe last modification time.
StatusMeaning and display suggestions
WAIT_PRE_PAID_BILLING_TO_DEPLOYING / WAIT_TO_DEPLOYPending purchase processing / Pending activation
RUNNINGRunning
WAIT_PRE_PAID_BILLING_TO_SCALING / SCALINGWaiting for a scaling order / Updating
STOPPING / STOPPEDStopping / Stopped; combine with deleted to distinguish Released
SUSPENDING / SUSPENDEDSuspending / Suspended
STARTING / RECOVERINGStarting / Resuming
DELETINGDeleting
FAILEDFailed; handle it based on the failure reason.
Deletion of pay-as-you-go instances and unsubscription of upfront instances can both be displayed uniformly as "Released": the condition is deleted=true, not just status=STOPPED. An instance with STOPPED + deleted=false is still a retained instance. Instances with deleted=true do not allow scaling, renewal, or deletion. The RUNNING status does not mean that all operations are available. When the same dedicated model code has an operation in progress or is subject to billing restrictions, the corresponding operations may be unavailable. Upfront SUSPENDED instances cannot be scaled; they can be renewed when the renewal conditions are met. Pay-as-you-go instances cannot be renewed. Before making a call, query the instance details again, use can_scale, can_renew, and can_delete to check whether an operation is available, and handle errors returned by the API.

Capacity operations (CapacityOperation)

FieldDescription
operation_idThe capacity operation ID, used to query operation results; it may be returned in the response of the corresponding write operation.
request_idThe request identity used to initiate this capacity operation.
operation_typeCommon values are CREATE, SCALE, RENEW, AUTO_RENEW, and DELETE; STOP and REFUND may also appear during lifecycle processing, which does not mean that public write APIs with the same names exist.
operation_statusValues: PROCESSING, SUCCEEDED, FAILED
model_service_idThe dedicated model code that the capacity instance or operation belongs to.
instance_idThe capacity instance ID. It may not be returned while the purchase order is still being processed; obtain it through subsequent queries.
from_statusThe instance status before the operation.
current_statusThe current instance status.
error_codeThe error code returned when the operation fails.
error_messageThe error message returned when the operation fails.
gmt_createdThe creation time.
gmt_finishedThe time when the operation completed.
When an operation is being executed or waiting in the queue, PROCESSING is returned. SUCCEEDED / FAILED are terminal states; after receiving a terminal state, stop polling and refresh the instance and deployment summaries.

Error Handling and Retry

Retry and Request Identity

When retrying the same capacity write operation over the network, keep the request identity and parameters unchanged. It is recommended to set x-acs-req-uuid and X-DashScope-RequestId to the same UUID, to avoid an inconsistency between the two changing the actual identity. The current priority order is x-acs-req-uuid, X-DashScope-RequestId, and X-Request-Id; if none is provided, a new identity is generated. A capacity operation with the same dedicated model code, the same valid request identity, and the same operation parameters reuses the existing operation; using the same identity with different parameters returns IDEMPOTENCY_KEY_CONFLICT. Use a new identity for each new business operation. Do not directly apply this instance-operation idempotency convention to the first creation of a dedicated model code.

Error codes

Error CodeHTTPSolution
CAPACITY_INSTANCE_REQUIRED400Specify the target instance_id when multiple instances exist
CAPACITY_INSTANCE_OPERATION_UNSUPPORTED400The operation is not supported by the current instance state: 8-hour window instances do not support scaling, renewal, or deletion; to delete a Model Code, you must first release all capacity instances and the state must be STOPPED
PREPAID_UNSUBSCRIBE_REQUIRED400Redirected to the existing unsubscription flow
POSTPAID_INSTANCE_ALREADY_EXISTS400Reuse an existing pay-as-you-go instance, or release it before creating a new one
CAPACITY_SLOT_LIMIT_EXCEEDED / TOTAL_CAPACITY_INSTANCE_LIMIT_EXCEEDED400The limit on active instance slots or the total number including historical records has been reached
MODEL_CODE_DELETED400Do not initiate write operations on a deleted throughput reservation
MODEL_CODE_NOT_FOUND / CAPACITY_INSTANCE_NOT_FOUND404Check the region, account, dedicated model code, and instance ownership; performing scaling on a deleted instance can also return CAPACITY_INSTANCE_NOT_FOUND
CAPACITY_OPERATION_NOT_FOUND404The operation does not exist or does not belong to the specified dedicated model code; verify the ID returned by the write operation
InternalError500May be returned when an operation query passes an invalid non-numeric ID; verify the ID first, and for other internal errors, keep the request_id and contact technical support
CAPACITY_INSTANCE_OPERATION_CONFLICT409Query existing operations and wait for them to complete before initiating a new operation
IDEMPOTENCY_KEY_CONFLICT409Keep the original parameters when retrying; use a new identifier for different business operations
BILLING_ACCOUNT_NOT_READY403Check whether the account meets the purchase requirements
BILLING_SERVICE_UNAVAILABLE503Query existing operations and handle retries with a backoff strategy
The HTTP errors in the table are thrown during the request phase; failures of asynchronous operations are returned through the error field of the operation object, so you cannot judge them only by the HTTP status code. Other general errors:
HTTP Status CodeError CodeSolution
400InvalidParameterParameter validation failed. Common triggers: incorrect field name or casing (the stacking API requires billing_method to be set to PRE_PAY/POST_PAY); passing enable when the model's fixed overflow policy is disable; the model does not support 8-hour windows; the 8-hour service window is outside the selling hours; the capacity violates the base, increment, or upper-limit constraints.
401InvalidApiKeyCheck the validity and region of the API Key.
403AccessDenied / Model.AccessDenied / App.AccessDeniedCheck account permissions, workspace, and model authorization.
404ModelNotFoundVerify the base model name and its supported scope.
409ConflictThe deployment name is duplicated; change the name or suffix.
429Throttling / Throttling.RateQuota / Throttling.AllocationQuota / QuotaLimitAllocationQuota indicates that the throughput reservation exceeds the quota; you can scale up the capacity or adjust the overflow policy. QuotaLimit indicates insufficient throughput reservation capacity quota in the workspace; you need to release or reduce existing capacity.
500RequestTimeOutCheck existing operations first to avoid duplicate purchases; keep the request_id and contact technical support.
503ModelUnavailableRetry later or switch to an available model.
For more information about handling rate limiting, see Best practices for handling rate limiting.