Usage Metering
Xinference tracks GPU resource consumption at the second level using a metered resource system.
Meter: gpu_instance_seconds
The primary billing meter is gpu_instance_seconds. It measures how many seconds each GPU instance type runs across your deployments.
How It's Recorded
When a deployment starts provisioning: 1. A metered resource record is created for each EC2 instance in the cluster. 2. A usage event is emitted each billing tick (approximately every minute). 3. Each event records the elapsed seconds since the last tick.
When a deployment terminates:
1. A final usage event closes out any remaining seconds.
2. The metered resource is marked stopped.
Dimensions
Usage events carry dimensions that identify the exact instance type:
{
"meter": "gpu_instance_seconds",
"unit": "second",
"quantity": 60,
"dimensions": {
"instance_type": "g5.xlarge",
"region": "us-east-1"
}
}
These dimensions are used to look up the per-second rate from the active price plan.
Billing Sync
For cloud-hosted deployments, Xinference reconciles usage against the AWS billing API to catch any discrepancies between the platform's internal records and actual EC2 runtime. This ensures you are never charged for instances that did not actually run.
Usage Anomalies
The platform monitors for billing anomalies — unusually high usage spikes or gaps in metering data. Anomalies are flagged for review and will appear in Billing → Anomalies if detected on your account.
Accessing Raw Usage Data
Via the API
Usage for the current billing period is available from the usage-summary endpoint. Authentication uses the session cookie set when you sign in (see Authentication).
import requests
r = requests.get(
"https://api.xinference.co/v1/billing/usage-summary",
cookies={"session": "<your-session-cookie>"},
)
summary = r.json()
for total in summary["usage_totals"]:
print(total["meter"], total["total_quantity"], total["dimensions"])
Rated Usage
Raw usage events are rated against the active price plan to produce monetary amounts. Rated usage items are what appear on your invoice.
Each rated item captures: - The usage event details - The price rate that was applied - The resulting amount (in USD, to 6 decimal places) - A snapshot of the rate at billing time (so historical invoices remain accurate even if prices change)
See Price Plans → for rate configuration details.