Billing Cycle and Usage Control
Platform Edition is billed at the platform (PlatformId) level: one Tencent Cloud account (UIN) can purchase multiple Platform Edition packages, each identified by a PlatformId. Once an environment belongs to a specific package, its resource usage is metered and deducted from that package's credits. This document explains how to query environment usage, control environment status, and the division of responsibilities between the platform and you, helping you implement "billing cycle + usage" management in your own business.
Responsibility Boundary Between the Platform and You
CloudBase provides the metering facts and execution APIs, while billing cycle rules, quota judgment, and disposal policies are implemented by you:
| Layer | Responsible party | Capabilities provided |
|---|---|---|
| Metering | CloudBase | Usage statistics, querying package (PlatformId) / environment usage by time range |
| Execution | CloudBase | Suspend / resume / destroy APIs (controlled + audited) |
| Notification | CloudBase | Reports environment credit usage to Cloud Monitor, which triggers alarm callbacks (not yet available) |
| Billing cycle | You (customer) | Billing cycle rules (period, quota reset / rollover) |
| Quota | You (customer) | Quota system (credits / traffic / requests, etc.) |
| Policy | You (customer) | Threshold judgment, alerts, suspend / resume / destroy decisions |
Every customer's business model (free trial, pay-as-you-go, prepaid, enterprise contracts) differs greatly, and the combination space of billing cycle and quota policies is huge (auto-renewal, suspend with retention, downgrade on expiry, overage pay-as-you-go, overdraft, etc.). CloudBase does not "make decisions" on policies for customers. Instead, it provides atomic capabilities that you combine according to your own business rules for maximum flexibility.
Querying Usage
The platform provides platform (PlatformId)-level and environment-level usage query capabilities, supporting queries of credit usage by specified time range, environment ID, and resource type, which can be used for billing cycle settlement, cost analysis, and quota judgment.
| Scope | API | Description |
|---|---|---|
| Platform (PlatformId) | DescribePlatformCreditsUsage | Get Platform Edition credit usage |
| Platform (PlatformId) | DescribePlatformCreditsUsageDetail | Get Platform Edition credit usage details |
| Single environment | DescribePlatformEnvUsage | Query the resource usage and details of a single environment under Platform Edition |
For the request parameters and response parameters of each API, see the corresponding API documentation.
Usage suggestions:
- Billing cycle settlement: query cumulative usage by time range at the end of each billing cycle for reconciliation and settlement
- Cost analysis: query usage by environment and time period to identify high-consumption environments
- Quota judgment: compare the query results with the quota thresholds you set, and trigger subsequent disposal
Controlling Environment Status
The platform provides environment-level status control APIs. You can suspend / resume / destroy a single environment according to your business strategy:
| Operation | API | Description |
|---|---|---|
| Suspend | ModifyPlatformEnv | The environment enters a suspended state (with the same effect as isolation); running services stop, data is retained, credits continue to be consumed, and it can be resumed on demand |
| Resume | ModifyPlatformEnv | Restore a suspended environment to a normal usable state |
| Destroy | DestroyPlatformEnv | Delete the environment (data will be cleared; operate with caution) |
For the request parameters and response parameters of each API, see the corresponding API documentation.
- Suspend / resume only supports manual triggering; it cannot be called when the associated package is in a system suspension state (overrun service suspension / expiry isolation).
- After suspension, data is retained and credits continue to be consumed.
- Destruction clears data; please confirm there are no business dependencies before operating.
Usage Notification Methods
To determine "which environments need disposal", there are two usage notification methods:
| Method | Trigger | Impact of environment count growth |
|---|---|---|
| Scheduled polling | Fixed-interval sampling; a threshold crossing is found after the fact | API calls grow linearly with the number of environments |
| Event callbacks | Callback as soon as a threshold is crossed | Independent of environment count |
Method 1: Scheduled polling
You traverse the environment list with scheduled tasks, query usage by each billing cycle, compare with quotas, and issue disposal:
Suitable for scenarios with a small number of environments. When there are many environments, full polling generates a large number of API calls (number of environments × polling frequency).
Method 2: Event callbacks (not yet available)
CloudBase reports environment-level credit usage to Cloud Monitor, which evaluates your alarm policies and calls back your system through a notification template. You only process the environments that triggered an alarm, instead of traversing every environment.
This capability is not yet available. The setup below describes how it will work once available; until then, use Method 1 (scheduled polling).
Reported metrics
| Metric | metricName | Definition (pending deductions excluded) | Unit |
|---|---|---|---|
| Credit usage | resource_point_deducted_usage | Credits actually consumed within the billing cycle, including packages, resource bundles, and pay-as-you-go | credits |
Metrics are reported per environment. The namespace is qce/tcb, and dimensions always contains the envId key. The metric is a cumulative value within a billing cycle and increases monotonically, and it resets when the cycle switches. Thresholds therefore only need a "greater than N" comparison, with no need to handle value drops.
Credit usage includes the pay-as-you-go part. To determine whether the package has been exceeded, compare this metric with the total credits in the package.
⚠️ After the cycle switches and counters reset, a triggered alarm is delivered once as a recovery (
alarmStatusis0). This is expected behavior; handle it as a recovery event.
Setup steps
- Confirm the metrics are reported: in Cloud Monitor, query the target environment's metrics by namespace
qce/tcband dimensionenvId. - Create an alarm policy: select the credit usage metric, set the alarm object to environments (a single environment or all of them), and configure an absolute threshold based on your budget plus a statistical period.
- Bind a notification template: choose "Interface callback (Webhook)" as the notification channel and provide a public HTTPS URL. A cloud function (intranet delivery) or log service is also available.
- Handle the callback: parse the environment ID, metric name, and cumulative value, distinguish alarm from recovery by
alarmStatus, and then apply your policy.
Callback fields
| What to read | Payload location | Description |
|---|---|---|
| Environment ID | alarmObjInfo.dimensions.envId | The dimension key fixed at reporting time |
| Metric name | alarmPolicyInfo.conditions.metricName | Always resource_point_deducted_usage |
| Current cumulative value | alarmPolicyInfo.conditions.currentValue | The cumulative value at trigger time; its meaning depends on the subscribed metric |
| Configured threshold | alarmPolicyInfo.conditions.calcValue | Same unit as currentValue |
| Alarm or recovery | alarmStatus | 1 alarm, 0 recovery |
| First threshold crossing time | firstOccurTime | Combine with durationTime to compute the duration |
| Account ownership | alarmObjInfo.appId, alarmObjInfo.uin | Verify data ownership in multi-tenant scenarios |
{
"alarmStatus": 1,
"alarmType": "metric",
"alarmObjInfo": {
"region": "ap-shanghai",
"namespace": "qce/tcb",
"appId": "1250000000",
"uin": "100000000001",
"dimensions": {
"envId": "prod-1a2b3c"
}
},
"alarmPolicyInfo": {
"policyName": "Environment credit usage alarm",
"conditions": {
"metricName": "resource_point_deducted_usage",
"calcType": ">",
"calcValue": "1000000",
"currentValue": "1048576"
}
},
"firstOccurTime": "2026-11-10 15:00:00",
"recoverTime": "0"
}
⚠️ The receiver must return HTTP 200 within 5 seconds. A timeout or non-200 response counts as a failed delivery; Cloud Monitor retries at most 3 times and then discards the message. Keep the receiver to parsing and persistence, and run policy judgment asynchronously.
Alarms fire per alarm object: one notification per environment, and separately for each metric subscribed on the same environment. The receiver must process each dimensions.envId independently.
Recommended Implementation Flow
- Purchase the package and create environments: see Purchase and Initialization and Create Environments
- Deliver API Keys: see Manage API Keys
- Build a billing cycle engine: define billing cycle rules (period, quota reset / rollover) and a quota system (credits / traffic / requests)
- Integrate usage notification: obtain usage for each environment via scheduled polling (event callbacks are not yet available; see Usage Notification Methods)
- Implement disposal policies: compare usage with quotas and trigger suspend / resume / destroy / alert actions
Next Steps
- Learn about environment lifecycle management: Create Environments
- Learn about the package and billing model: Platform Edition Overview