All Products
Search
Document Center

Alibaba Cloud Model Studio:Throughput Reservation API Reference

Last Updated:Nov 24, 2026

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 independently.

nodeAPIReference
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 the throughput reservation list
Purchase an additional capacity instancePOST /api/v1/deployments/{deployed_model}/capacity-instancesPurchase an additional capacity instance
Scale a capacity instancePUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/scaleScale a capacity instance
Renew a capacity instancePUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/renewRenew a capacity instance
Enable / disable auto-renewalPUT /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}/auto-renewSet auto-renewal
Unsubscribe / release a capacity instanceDELETE /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}Delete a 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 a throughput reservation
Query the capacity instance listGET .../capacity-instancesQuery the capacity instance list
Query capacity operation statusGET .../operations/{id}Query capacity operation status
Error codes—Error codes

Authentication and call preparation

Use the Model Studio API Key of the region you are calling and pass Authorization: Bearer <api-key> in the request header. API Keys are bound to a region and cannot be used across regions. When the request body is JSON, pass Content-Type: application/json.

The workspace-specific domain format is https://{workspaceId}.{region}.maas.aliyuncs.com; use the Endpoint of the target workspace and region. To specify a sub-workspace, carry X-DashScope-WorkSpace: <workspace-id>。

The DashScope API domain is https://dashscope-intl.aliyuncs.com (Singapore). 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 using the API.

General rules

The base path of the APIs is /api/v1/deployments, which follows the DashScope OpenAPI domain and authentication method of the region you call. Request bodies use Content-Type: application/json. Use the account, models, and deployments of the target region.

  • deployed_model: The dedicated model code of the throughput reservation (the calling identity); model_service_id in instance/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.
  • IDs, model names, and capacity values in the examples below are placeholders. Actual models, minimum values, increments, limits, and purchase durations are subject to the models and purchase limits 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 uniformly wrapped as:

{
  "request_id": "example-request",
  "output": {}
}

Request error example:

{
  "request_id": "example-request",
  "code": "CAPACITY_INSTANCE_REQUIRED",
  "message": "需要指定容量实例"
}

ImportantA successful HTTP request does not mean the capacity operation succeeded. Even if an instance write API returns HTTP 200, output.operation_status may still be FAILED. You must 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 through 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 incremental 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 in order; while an operation is in progress, new changes may be rejected. Accepted unsubscribe/release requests are queued and continue after preceding operations complete. Before a change takes effect, queries still return the original effective capacity; do not treat the target capacity as already in effect.

After an addition, scaling, or release takes effect, you can obtain the updated aggregate effective capacity through the deployment query APIs and continue using the original dedicated model code. Calling a model also requires completing the corresponding model deployment and using correct account authentication and calling 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 is processed 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; see capacity parameters
pre_paid_infoObjectConditionally requiredRequired for upfront; see prepaid parameters; not passed for Pay-as-you-go
overflow_strategyStringNoOverflow policy: enable means excess requests are billed on a Pay-as-you-go basis, and disable means requests are rate-limited once capacity is exceeded; set at creation time

ptu_default supports upfront payment; ptu_fast supports both upfront and pay-as-you-go billing. 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 time slots. By day corresponds to pricing_cycle=Day, and an 8-hour time slot corresponds to pricing_cycle=Hour with duration=8. The 8-hour time slot is supported only by ptu_default Standard mode, not by ptu_fast High-Speed. An 8-hour service slot 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). An 8-hour time slot can be newly created through this API (pass pricing_cycle=Hour with duration=8) or appended to an existing reservation via stacked capacity instance purchase.

Upfront (by day) 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-intl.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
    }
}'

Upfront payment example for an 8-hour time slot (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/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 by only some models

When scaling, this is the absolute capacity of the selected instance after the change, not an increment, and not 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; the unit follows pricing_cycle: Day in days, Hour in hours 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 using Query capacity operations; if the creation request times out, confirm first 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 aggregated capacity that has taken effect across all capacity instances.

curl request example:

curl -X GET "https://dashscope-intl.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. For throughput reservations, the value is ptu.
statusThe status of the dedicated model code, which does not represent the status of each capacity instance
ptu_service_tierPerformance tier: ptu_fast for high speed and ptu_default for standard mode
ptu_capacityThe aggregated input and output capacity that has taken effect for 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 rules used to calculate the expiration moment, see Throughput reservation billing.
overflow_strategyThe overflow policy. enable means overflow usage is billed on a pay-as-you-go basis, and disable means requests are throttled once the capacity is exceeded. For more information about overflow billing rules, see Throughput reservation billing.
fail_reasonThe failure reason.
gmt_createCreated At.
gmt_modifiedLast Modified At.
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 individual instance.

Query 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-intl.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, defaults to 1
page_sizeNumber of items per page, defaults to 10, range [1,100]
planOptional type filter. Pass ptu when querying throughput reservations; the performance tier is represented by service_tier and is not used as 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 capacity instance list (including deleted instances).

Query 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-intl.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_noIntegerDefaults to 1
page_sizeIntegerDefaults to 20, range [1,100]
include_deletedBooleanDefaults to true; explicitly pass false to display 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
nameReservation name.
base_modelBase model name.
base_capacityCurrently effective capacity.
workspace_idWorkspace ID.
creatorCreator.
modifierLast modified by.
{
  "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-intl.aliyuncs.com/api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header "Content-Type: application/json"

NoteAfter a pay-as-you-go instance is released, repurchasing pay-as-you-go capacity under the same dedicated model code reuses the original instance ID. The list and details are updated with the repurchased instance information, and the original deletion record is no longer retained 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-intl.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 inside 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 querying a non-existent numeric ID or an operation belonging to another dedicated model code, HTTP 404 and CAPACITY_OPERATION_NOT_FOUND are returned; an invalid operation ID may return InternalError. Verify the ID first before retrying.

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, POST_PAY for pay-as-you-go. Values are case-sensitive
ptu_capacityYesNew instance capacity
pre_paid_infoConditionally requiredRequired for upfront; omitted 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-intl.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 additional 8-hour time slot (only for 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-intl.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 period must fall entirely within the daily sales window of 22:00–08:00, 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 time-slot 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 Beijing-time hour boundary; gmt_expired is 8 hours after gmt_effective; 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-intl.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 in progress. 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 instance quantity do not meet the requirements, handle the error returned by the API.

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-intl.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 parameters have the same semantics as 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 after expiry cannot be scaled directly and should be renewed first. 8-hour time-slot instances do not support scaling; the call returns CAPACITY_INSTANCE_OPERATION_UNSUPPORTED.

Renew capacity instances

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-intl.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-intl.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-window instances do not support renewal or auto-renewal; calling this API 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-intl.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; always pass Day. Passing any other value returns InvalidParameter
auto_renewal_durationIntegerYesNumber of days purchased per auto-renewal, as 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-window instances do not support auto-renewal.

Delete capacity instances

DELETE /api/v1/deployments/{deployed_model}/capacity-instances/{instance_id}

The optional query parameter reason specifies the deletion reason and is URL-encoded; no JSON request body is required. Returns an operation object.

curl request example:

curl -X DELETE "https://dashscope-intl.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 through the deletion workflow; once completed, deleted=true and status=STOPPED, with zero effective capacity.
  • Active upfront instances: this API cannot replace unsubscription; calling it directly returns PREPAID_UNSUBSCRIBE_REQUIRED. After the unsubscription is completed and the capacity is released, the final result is likewise deleted=true and status=STOPPED.
  • 8-hour time-window instances do not support deletion or unsubscription; the capacity automatically expires when the time window ends. Calling this API returns PREPAID_UNSUBSCRIBE_REQUIRED.
  • can_delete=true indicates that the current state allows entering the deletion / unsubscription workflow; it does not mean upfront instances can skip unsubscription and call DELETE directly. For failed instances that have no associated order yet, handle them based on the API response.

Unsubscription and release is an asynchronous operation. When the same dedicated model code is processing other operations, an accepted release operation queues and waits; before it completes, queries 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 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-intl.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 requests exceeding the capacity receive a 429 rate-limit error (only the reserved capacity is used). The configuration applies to the entire dedicated model code; capacity packs do not have separate overflow strategies. For overflow billing rules, see Throughput Reservation Billing.

The response contains request_id and output. After the modification, you can call Query throughput reservation to retrieve overflow_strategy and confirm that 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
    }
  }
}

WarningAfter the overflow strategy is enabled, traffic exceeding the capacity is billed on a pay-as-you-go basis and incurs additional charges. After it is disabled, requests exceeding the capacity are rate-limited. For 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; switching to Scale capacity instances is recommended. This API is retained for compatibility and returns a deployment object instead of a capacity operation object.

PUT /api/v1/deployments/{deployed_model}/scale

Adjusts the input and output capacity of a capacity instance under the specified throughput reservation. When multiple non-deleted instances exist, you must specify the target instance via instance_id.

FieldRequiredDescription
instance_idConditionally requiredRequired when there are multiple non-deleted instances; can be omitted when only one non-deleted instance exists
ptu_capacityYesThe absolute capacity of the instance after the change
pre_paid_infoNoFor upfront instances, reuses the saved information when not passed; not passed for pay-as-you-go
order_typeNoUPGRADE indicates a scale-up and DOWNGRADE indicates a scale-down; when omitted, the server determines it, and the passed value 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-intl.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 the throughput reservation information, and the ID of the corresponding capacity operation is returned via operation_id. With multiple instances and no ID specified, CAPACITY_INSTANCE_REQUIRED is returned. For new integrations, Scale capacity instances is recommended.

Upfront changes involve orders, while pay-as-you-go does not go through upfront change orders. The original effective capacity is retained until the change is confirmed; on failure, the target capacity must not be presented as effective. Scaling to all-zero capacity is not equivalent to deleting an instance.

Renew (legacy API)

Legacy API; switching to Renew capacity instances is recommended. This API is retained for compatibility and returns a deployment object instead of a capacity operation object.

PUT /api/v1/deployments/{deployed_model}/renew

Renew a specified upfront capacity instance, with the option to adjust capacity at the same time. 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 for single-instance compatibility
pre_paid_infoYesRenewal information, see prepaid parameters
is_changeNoDefaults to false; whether to adjust capacity at the same time
ptu_capacityNoIf omitted, the configured capacity is retained; when a different capacity is passed, is_change=true is required

Renew with auto-renewal enabled:

{
  "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-intl.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-intl.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 Renew a capacity instance API 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 no capacity operations may be running or queued before deleting the entire deployment. Returns the deployment object.

curl request example:

curl -X DELETE "https://dashscope-intl.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; the dedicated model code is not automatically deleted as a result. Deleting a capacity instance and deleting the dedicated model code are two different 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)
statusStringInstance lifecycle status, see the table below
deletedBooleanWhether it has been deleted / released, used to identify released instances
effective_capacityObjectThe capacity currently confirmed to be in service
configured_capacityObjectInstance configured / contracted capacity; retained even when stopped or suspended
target_capacityObjectThe target capacity being changed; may not be returned or may be empty in a stable state
pre_paid_infoObjectThe upfront purchase and renewal configuration of this instance, including pricing_cycle (Day by day / Hour as an 8-hour period), see prepaid parameters.
gmt_effectiveStringThe effective time of the upfront instance; 8-hour period instances take effect on the hour in Beijing time. Parse by time zone offset, and do not treat the hour value of +00:00 directly as Beijing time.
gmt_expiredStringThe expiration time of the upfront 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 the instance is currently allowed; fixed to false for 8-hour period instances.
can_renewBooleanWhether renewing the instance is currently allowed; fixed to false for 8-hour period instances.
can_enable_auto_renewBooleanWhether enabling auto-renewal is currently allowed; fixed to false for 8-hour period instances.
can_disable_auto_renewBooleanWhether disabling auto-renewal is currently allowed; fixed to false for 8-hour period instances.
can_deleteBooleanWhether deleting or unsubscribing the instance is currently allowed; upfront instances must still complete the unsubscribe process, fixed to false for 8-hour period instances.
fail_reasonStringFailure reason
nameStringReservation name.
model_nameStringBase model name.
planStringFixed to ptu.
ptu_capacityObjectCapacity configuration (input_tpm / output_tpm).
ptu_service_tierStringReasoning mode (ptu_default / ptu_fast).
overflow_strategyStringOverflow policy.
gmt_createTimeCreated At.
gmt_modifiedTimeLast Modified At.
StatusMeaning and display suggestion
WAIT_PRE_PAID_BILLING_TO_DEPLOYING / WAIT_TO_DEPLOYWaiting for purchase processing / waiting to take effect
RUNNINGRunning
WAIT_PRE_PAID_BILLING_TO_SCALING / SCALINGWaiting for a scaling order / updating
STOPPING / STOPPEDStopping / stopped; use deleted to distinguish released instances
SUSPENDING / SUSPENDEDSuspending / suspended
STARTING / RECOVERINGStarting / resuming
DELETINGDeleting
FAILEDFailed; handle it based on the failure cause

Pay-as-you-go deletion and upfront unsubscription can be uniformly displayed as "Released": the condition is deleted=true instead of only status=STOPPED. STOPPED + deleted=false is still a retained instance. Instances with deleted=true do not allow scaling, renewal, or deletion.

RUNNING does not mean that all operations are available. When the same dedicated model code has an operation in progress or has billing restrictions, the corresponding operations may be unavailable. Upfront SUSPENDED instances cannot be scaled but can be renewed when they meet renewal conditions; pay-as-you-go instances cannot be renewed. Re-query instance details before making the call, check whether operations are available via can_scale, can_renew, and can_delete, 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 that initiated 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 imply that public write APIs of the same name exist
operation_statusValid values: 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 status of the instance.
error_codeThe error code returned when the operation fails.
error_messageThe error message returned when the operation fails.
gmt_createdCreated At.
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; stop polling after receiving a terminal state and refresh the instance and deployment summary.

Error Handling and Retry

Retry and Request Identity

For network retries of the same capacity write operation, 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 the actual identity changing due to inconsistency between the two. 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.

Capacity operations with the same dedicated model code, the same valid request identity, and the same operation parameters reuse 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 code

Error codeHTTPSuggested action
CAPACITY_INSTANCE_REQUIRED400When multiple instances exist, specify the target instance_id
CAPACITY_INSTANCE_OPERATION_UNSUPPORTED400The operation is not supported by the current instance status: 8-hour slot instances do not support scaling/renewal/deletion; to delete a Model Code, you must first release all capacity instances, and the status must be STOPPED
PREPAID_UNSUBSCRIBE_REQUIRED400Redirected to the existing unsubscribe process
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 valid instance slots / the total count including historical records has been reached
MODEL_CODE_DELETED400Do not issue write operations against a deleted throughput reservation anymore
MODEL_CODE_NOT_FOUND / CAPACITY_INSTANCE_NOT_FOUND404Check the region, account, exclusive model code, and instance ownership; running scaling against 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 exclusive 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 first, and initiate a new operation only after they complete
IDEMPOTENCY_KEY_CONFLICT409Keep the original parameters when retrying; use a new identity 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

HTTP in this table refers to errors thrown during the request phase; failures of asynchronous operations are returned through the error field of the operation object, so you cannot judge solely by the HTTP status.

Other general errors:

HTTP Status CodeError codeSuggested action
400InvalidParameterParameter validation failed. Common triggers: incorrect field names or casing (the stacked API billing_method must be PRE_PAY/POST_PAY); passing enable when the model's fixed overflow policy is disable; the model does not support 8-hour slots; the 8-hour service slot exceeds the slots available for sale; the capacity violates the minimum/step/maximum 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 the supported scope.
409ConflictDuplicate deployment name; change the name or suffix.
429Throttling / Throttling.RateQuota / Throttling.AllocationQuota / QuotaLimitAllocationQuota indicates that the throughput reservation quota is exceeded; you can scale up 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 rate limit handling, see Rate limiting best practices.