Skip to main content
POST
Query grouped usage cost subtotals for an account.

Authorizations

Authorization
string
header
required

Bearer authentication using your Fireworks API key. Format: Bearer <API_KEY>

Path Parameters

account_id
string
required

The Account Id

Body

application/json

Request for grouped usage cost subtotals over a time range.

startTime
string<date-time>
required

Inclusive lower bound for usage event timestamps.

endTime
string<date-time>
required

Exclusive upper bound for usage event timestamps.

scope
enum<string>
default:SCOPE_UNSPECIFIED
required

ACCOUNT requires account administrator access. SELF derives the user ID from the authenticated principal.

Available options:
SCOPE_UNSPECIFIED,
ACCOUNT,
SELF
groupBy
enum<string>[]
required

Dimensions to group by. At most three dimensions may be combined, of which at most two may be non-time. A three-dimension breakdown is served only for an unfiltered ACCOUNT query over at most 32 days. HOUR and DAY are mutually exclusive. SESSION is intentionally filter-only to prevent high-cardinality enumeration.

SERVERLESS_INFERENCE queries group by HOUR, DAY, MODEL, MODEL_TIER, USER, API_KEY and SERVICE_TIER. TRAINING queries group by DAY, JOB_ID, JOB_TYPE, OFFERING and TRAINING_SESSION, at most two of them besides OFFERING, over up to 100 days. TRAINING results are not paginated and hold at most 10,100 rows.

  • SERVICE_TIER: Groups costs by the requested service tier as recorded on the usage. Use MODEL_TIER to group by the serving capability tier used to price model usage.
  • JOB_ID: Training dimensions, valid only for TRAINING queries.
Available options:
DIMENSION_UNSPECIFIED,
HOUR,
MODEL,
USER,
API_KEY,
DAY,
MODEL_TIER,
SERVICE_TIER,
JOB_ID,
JOB_TYPE,
OFFERING,
TRAINING_SESSION
filter
object

Optional exact-match filters. All populated fields are ANDed.

pageSize
integer<int32>

For paginated queries, the maximum number of grouped values to return. A page can contain more rows when each value spans multiple time buckets. Zero uses the server default; values above the maximum are clamped.

pageToken
string

Opaque token from a previous response. Set this to retrieve the next page while keeping all other request fields unchanged.

Maximum string length: 4096
product
enum<string>
default:PRODUCT_UNSPECIFIED

Product whose usage is priced. Unset means SERVERLESS_INFERENCE.

Available options:
PRODUCT_UNSPECIFIED,
SERVERLESS_INFERENCE,
TRAINING

Response

200 - application/json

A successful response.

rows
object[]

Cost rows for the requested dimensions. A successful response contains at most 10,100 rows and is limited to 4 MiB.

nextPageToken
string

Opaque token for the next page. Empty when no additional page is available.

subtotal
object

Subtotal for the complete query.

evaluationTime
string<date-time>
read-only

Time when this result was evaluated.

attributionCompleteness
enum<string>
default:ATTRIBUTION_COMPLETENESS_UNSPECIFIED
read-only

Whether the result may omit usage without a user ID. INCOMPLETE means the query filters by user, so historical unattributed usage may be excluded. The amount excluded is unknown.

Available options:
ATTRIBUTION_COMPLETENESS_UNSPECIFIED,
COMPLETE,
INCOMPLETE,
UNKNOWN