Skip to main content

Overview

Fireworks reports billing along two dimensions:
  • Usage — metered quantities such as tokens, accelerator-seconds, and audio input seconds. You can break usage down by deployment, model, API key, or custom tags.
  • Cost — rated dollar amounts. Costs are reported at the account level: a range-wide total, or line items grouped by billing category (serverless, dedicated, training). They aren’t broken down by the same dimensions as usage, so per-API-key or per-deployment dollar figures aren’t returned today — to approximate them, multiply usage by the published serverless prices.
Two tools expose this data: The CLI and billingUsage share the same usage response shape and dimensions. Most examples below show the CLI form and the equivalent cURL side by side. Over HTTP, grouping and time-range parameters go on GET /billingUsage; filtering uses the companion POST /billingUsage:query endpoint, which carries the filter in a JSON body.
  • GET /billingUsage — metered quantities (tokens, accelerator-seconds) grouped by deployment/model/API key/custom tags. No dollars. To filter (not just group) over HTTP, use POST /billingUsage:query with the same request shape in a JSON body (see the filter examples below).
  • GET /billing/summary — rated dollar line items by billing category (serverless, dedicated, training), grouped by your billing config. Optional daily buckets. No per-model/per-key breakdown.
  • POST /usageCosts:query — rated dollar subtotals grouped by caller-supplied dimensions (HOUR, DAY, MODEL, USER, API_KEY), with pagination and an account-wide subtotal. This is the endpoint to use when you need costs (not just quantities) broken down by model, user, or API key. Requires account administrator access for ACCOUNT scope; SELF scope returns only the authenticated user’s costs. See Query usage costs.
This page complements Exporting Billing Metrics: use export-metrics for a raw per-event CSV dump, and the workflows here for grouped usage and rated views.
CLI examples require firectl 1.7.21 or later. Run firectl version, then firectl upgrade if needed.

Authentication

For the API, send your Fireworks API key as a bearer token. Any key on the target account works.
For the CLI, run firectl login once and firectl reads credentials from ~/.fireworks/auth.ini.

Basic usage

Get a 30-day account-wide breakdown (defaults to all usage types, grouped by model for serverless and by deployment + accelerator for dedicated):
Add -o json for machine-readable output.

Examples

Serverless usage by model

Serverless usage by API key

Breaks out serverless token consumption per API key. Pass both api_key_id (stable internal ID) and api_key_name (human-readable label from the console / firectl api-key create --name) so the response carries both.
Sample row from the API response:
Token counts come back as JSON strings (int64 over JSON). Cast them with tonumber in jq or the equivalent in your client before doing arithmetic. The deprecated top-level apiKeyId field is only populated when groupBy=api_key_id is requested — always read API-key values from the group map.

Filter to a specific API key

Multiple values for the same dimension are OR’ed; different dimensions are AND’ed. In firectl, repeat --filter to OR values; over the API, list them in the dimension’s values array. Over HTTP, filter with POST /billingUsage:query, which takes the same request in a JSON body, where filter is a map of dimension → { "values": [...] }.

Dedicated deployment usage by deployment and GPU type

Filter to a single deployment

Account-level cost totals only

Get just the rated costs, without the usage rows:

Reference

CLI flags

Run firectl billing get-usage --help for the full list.

API parameters

Over HTTP, pass dimensions as groupBy=<dim> (repeat for multiple). usageType takes SERVERLESS, DEDICATED_DEPLOYMENT, or omitted for all. timezone and startTime/endTime mirror the CLI flags. See the full API reference for parameter schemas and response types. To filter over HTTP, send POST /v1/accounts/{account_id}/billingUsage:query with the same request in a JSON body, where filter is a map of dimension → { "values": [...] } (repeated values OR within a dimension; distinct dimensions are AND’ed).

Grouping dimensions

Valid --group-by / groupBy and --filter / filter dimensions depend on the usage type, and both are available over CLI and HTTP (grouping on GET /billingUsage, filtering on POST /billingUsage:query):
  • Serverless: model_name, api_key_id, api_key_name, annotations.team, annotations.project, annotations.environment
  • Dedicated deployment: deployment_name, accelerator_type, annotations.team, annotations.project, annotations.environment
Dedicated-deployment rows also include the deployment’s region (placement, e.g. US, EUROPE, GLOBAL) and metered accelerator_seconds.

Custom tags (team / project / environment)

Group by annotations.team, annotations.project, or annotations.environment to split usage by your own labels. The tag source depends on usage type:
  • Dedicated deployments: set an annotations map on the deployment, e.g. {"team": "search", "project": "x", "environment": "prod"}.
  • Serverless: send a per-request header on inference calls:
    Annotation values are validated server-side. Only the recognized keys — team, project, environment — are stored; any other segment (an unknown key, an empty value like project=, or a bare token) is dropped on its own, and the recognized keys in the same header are always preserved. In responses these tags appear under the short keys team / project / environment in the group map: you group and filter by the annotations.-prefixed names, but the response omits the prefix.

Cookbook: per-API-key reporting recipes

These recipes target the HTTP API, where downstream aggregation in jq (or any client) is easiest.

Aggregate per key, across models

Sums prompt and completion tokens for each API key across every model it called, sorted by prompt volume.

Group by model, then by key (cost-by-tool view)

If reporting starts from “how much did each model cost me, and which keys drove that”, flip the nesting:
Multiply the token totals by the published serverless prices to convert to dollars for chargeback.

Backfill more than 31 days

The endpoint caps each request at a 31-day window. To pull a longer history, loop month-by-month:

Granularity and freshness

  • Usage is aggregated into daily buckets (--timezone / timezone= sets the day boundary). There are no sub-daily buckets.
  • Responses are cached for several minutes — fine for cron jobs and dashboards, not for real-time.

Coverage caveats

  • Tokens, not dollars. The endpoint returns metered quantities (promptTokens, completionTokens, accelerator_seconds, audioInputSeconds). Multiply by the serverless prices for cost, or use --account-costs-only for account-level dollar totals.
  • Inference types covered today: text completion / chat completion and audio inference. Embeddings and image generation aren’t yet reflected in billingUsage responses; coverage will expand in subsequent releases.
  • Dedicated deployments are attributed at the deployment level, not by API key. Use usageType=DEDICATED_DEPLOYMENT with groupBy=deployment_name for that breakdown.
Run firectl billing get-usage --help to see all available CLI flags and options.

See also