AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help

Billing queries and export

Select a period, inspect consumption statistics, and export Excel billing records.

Billing statistics aggregate model usage, call counts, and amounts by time interval. Excel records are for saving and offline review.

Prepare an access token

Create an access token under “Security” on your profile, then enter it in Try It for Query billing statistics or Export billing records.

Choose the period and filters

  1. Select the interval, such as “Day” for daily totals.
  2. Enter start/end Unix timestamps in seconds, or use the date picker on the right. It converts browser-local dates; for full days, check that the end time includes the entire day.
  3. Fill in a name only to filter a specific API Key or model; leave both fields empty to include all matching records.
FilterRequiredUsage
Interval typeYes1=minute, 2=hour, 3=day, 4=week, 5=month
Start and endYesstartTime, endTime in seconds; end cannot precede start
API Key name tokenNameNoName, not a secret Key or access token; omit to avoid name filtering
Model name modelNameNoActual model name; omit to avoid model filtering

Query and inspect statistics

Submit filters in Try It for Query billing statistics. Body code=200 indicates business success; data is an array of aggregate records, not individual call logs.

  • time, timeGroup: record time and second-based grouping timestamp.
  • callCount, totalUseTime: call count and total duration.
  • totalPromptTokens, totalCompletionTokens, and cache fields: input, output, and cache usage.
  • totalAmount: amount consumed. See the Reference for fields and complete examples; Token usage is not a monetary amount.

code: 200 with data: [] means the query succeeded but no records match the period and filters.

Some optional fields may be null; do not treat them as 0.

Export Excel billing records

Submit the same filters in Try It for Export billing records. After a successful file response:

  1. Verify the export period shown in the result.
  2. Keep the generated period-based filename or edit “File name”; the .xlsx extension is retained automatically.
  3. Click “Download Excel billing records” to save locally.

Filename dates use the browser's local timezone. The platform generates Excel contents and columns; renaming does not change them. Use identical periods, intervals, and name filters when comparing statistics with exports.

HTTP 200 does not guarantee export success: handle JSON business errors first; do not save them as .xlsx.

Troubleshooting

SymptomAction
Successful query without recordsCheck timestamp units and dates, then clear name filters
Business code: 401, authentication failedCheck the access token; contact support if a valid token still fails
Export business code: 400, parameter validation failureCheck the interval and both timestamps
Export business code: 500, ERRORCheck JSON syntax and parameter types; contact an administrator if correct input still fails
Download cannot open in ExcelCheck Content-Type; ensure a JSON business error was not saved as Excel

These export business errors may use HTTP 200; do not rely on HTTP status alone. See the corresponding Reference for complete examples.

See current model prices in the model marketplace.

Call from your application

The Bash example requires curl and jq, covering authentication, statistics, and saving Excel.

On this page