Usage & Billing
The AI Gateway provides endpoints to monitor your credit balance, track usage, and retrieve detailed information about specific generations.
The Usage & Billing API is available at the following base URL:
The AI Gateway supports the following Usage & Billing endpoints:
- - Check your credit balance and usage information
- - Retrieve detailed information about a specific generation
Check your AI Gateway credit balance and usage information.
- : The remaining credit balance
- : The total amount of credits used
Retrieve detailed information about a specific generation by its ID. This endpoint allows you to look up usage data, costs, and metadata for any generation created through the AI Gateway. Generation information is available shortly after the generation completes. Note much of this data is also included in the field of the chat completion responses.
- (required): The generation ID to look up (format: )
- : The generation ID
- : Total cost in USD for this generation
- : Usage cost (same as total_cost)
- : ISO 8601 timestamp when the generation was created
- : Model identifier used for this generation
- : Whether this generation used Bring Your Own Key credentials
- : The provider that served this generation
- : Whether this generation used streaming ( for streamed responses, otherwise)
- : Time to first token in milliseconds
- : Total generation time in milliseconds
- : Number of prompt tokens
- : Number of completion tokens
- : Native prompt tokens (provider-specific)
- : Native completion tokens (provider-specific)
- : Reasoning tokens used (if applicable)
- : Cached tokens used (if applicable)
Was this helpful?