Management API
Billing Management
Get billing information
/v1/billing/teams/{team_id}/billing-info
Get billing information of the team with given team ID.
Path parameters
team_id
string
required
Team ID of the team.
Response Body
billingInfo
object
Billing info.
Set billing information
/v1/billing/teams/{team_id}/billing-info
Set billing information of a team.
Path parameters
team_id
string
required
Team ID of the team.
Request Body
List Invoices
/v1/billing/teams/{team_id}/invoices
List invoices that belong to a team.
Path parameters
team_id
string
required
Team ID of the team.
Query parameters
billingCycle.year
integer
billingCycle.month
integer
since.year
integer
since.month
integer
invoiceIds.invoiceIds
array
Response Body
invoices
array
Invoices.
List payment methods
/v1/billing/teams/{team_id}/payment-method
List payment methods of a team. You can add or delete the payment methods on https://console.x.ai.
Path parameters
team_id
string
required
Team ID of the team.
Response Body
paymentMethods
array
Payment methods on file.
pendingPaymentMethod
object
Represents an incomplete attempt to add a payment method. Might resolve into a payment method.
Set default payment method
/v1/billing/teams/{team_id}/payment-method/default
Set default payment method to an existing payment method on file.
Path parameters
team_id
string
required
Team ID of the team.
Request Body
Preview postpaid invoice of the month
/v1/billing/teams/{team_id}/postpaid/invoice/preview
Preview the amount to pay for postpaid usage in the current billing period.
Path parameters
team_id
string
required
Team ID of the team.
Response Body
coreInvoice
object
The invoice object.
effectiveSpendingLimit
string
The effective current spending limit in USD cents.
defaultCredits
string
The current default credits in USD cents.
billingCycle
object
Get monthly postpaid spending limits
/v1/billing/teams/{team_id}/postpaid/spending-limits
Get the postpaid monthly spending limits. The API will stop functioning once the team has consumed all of the prepaid credits, and the postpaid usage amount has reached the user-set soft spending limit.
Path parameters
team_id
string
required
Team ID of the team.
Response Body
spendingLimits
object
Postpaid monthly spending limit.
Override might not exist, hence optional (actually, this comes from
either default hard_spending_limit override or monthly
hard_spending_limit override).
Set monthly postpaid spending limits
/v1/billing/teams/{team_id}/postpaid/spending-limits
Set the postpaid monthly spending limit of a team. This can be used to restrict the maximum amount of postpaid API usage. Note this will not limit the amount of prepaid credit usage, and prepaid credits will always be consumed before accruing postpaid usage. To use only prepaid credits, you can set this limit to 0.
Path parameters
team_id
string
required
Team ID.
Request Body
Response Body
thisBpSoftSpendingLimit
object
Representation of USD Cents.
List prepaid credit balance and balance changes
/v1/billing/teams/{team_id}/prepaid/balance
List the prepaid credit balance and balance changes of a team.
Path parameters
team_id
string
required
The team ID of the team.
Response Body
changes
array
The changes of the prepaid credit balance.
total
object
Representation of USD Cents.
Top up prepaid credit
/v1/billing/teams/{team_id}/prepaid/top-up
Top up prepaid credit using the default payment method.
Path parameters
team_id
string
required
Team ID of the team to top up for.
Request Body
Response Body
change
object
Change item on the prepaid credit balance.
Get historical usage of the API
/v1/billing/teams/{team_id}/usage
Get historical usage of the API over a time period, aggregated by fields.
Path parameters
team_id
string
required
The team whose billing records to analyze.
Request Body
Response Body
timeSeries
array
For each value of the group-by clause, we return one time series.
limitReached
boolean
If this is true, the maximum cardinality of the query has been reached and only a subset of results is returned.
Did you find this page helpful?