Get credit usage

creditUsage(input: CreditUsageInput): CreditUsage!

Requires account.billing.read.

Arguments

ArgumentTypeRequired
inputCreditUsageInputNo

Input fields

input

CreditUsageInput

FieldTypeRequiredDescription
fromStringNoInclusive timestamp; supply to and omit preset.
toStringNoExclusive timestamp with an explicit offset.
granularityStringNohour, day, week or month; defaults to day.
groupBy[String!]Noproject, model, api_key or member.
compareStringNoprevious_period adds the preceding timeframe and summary.
presetStringNo7d, 30d or 90d. Defaults to 30d.
timezoneStringNoIANA time zone for daily bucket boundaries. Defaults to UTC.
projectReferenceStringNoProject ID or slug that narrows the read to one project of the account

Response

Returns CreditUsage!. Open the type for its fields and nested types.

FieldTypeDescription
scopeCreditUsageScope
groupBy[String!]
summaryCreditUsageTotals!
timeframeUsageTimeframe!
series[CreditUsageBucket!]!
projects[CreditUsageProject!]!
models[CreditUsageModel!]!
serving[CreditUsageServing!]Omitted where the serving breakdown is not enabled

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
query CreditUsage($input: CreditUsageInput) {
  creditUsage(input: $input) {
    groupBy
  }
}
json
{}