Skip to main content
GET
/
v1
/
accounts
/
{account_id}
/
billingUsage
Get Account Usage
curl --request GET \
  --url https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fireworks.ai/v1/accounts/{account_id}/billingUsage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "serverlessCosts": [
    {
      "modelName": "<string>",
      "promptTokens": "<string>",
      "completionTokens": "<string>",
      "startTime": "2023-11-07T05:31:56Z",
      "endTime": "2023-11-07T05:31:56Z",
      "audioInputSeconds": 123,
      "usageType": "<string>",
      "apiKeyId": "<string>",
      "group": {}
    }
  ],
  "dedicatedCosts": [
    {
      "deploymentId": "<string>",
      "acceleratorType": "<string>",
      "acceleratorSeconds": "<string>",
      "startTime": "2023-11-07T05:31:56Z",
      "endTime": "2023-11-07T05:31:56Z",
      "baseModel": "<string>",
      "usageType": "<string>",
      "placement": "<string>",
      "group": {}
    }
  ]
}

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

Query Parameters

startTime
string<date-time>
required

Costs returned are inclusive of start_time. start_time must be before end_time.

endTime
string<date-time>
required

Costs returned are exclusive of end_time. end_time must not be more than 31 days after start_time.

usageType
enum<string>
default:USAGE_TYPE_UNSPECIFIED

Usage type to query usage for. If not specified, returns all usage types (serverless, dedicated deployments, and training).

  • USAGE_TYPE_UNSPECIFIED: Default value. When specified (or when usage_type field is not set), returns usage data for all deployment types: serverless requests, dedicated deployments, and training jobs.
  • SERVERLESS: Returns only serverless usage data. Filters the response to include only usage from serverless API requests.
  • DEDICATED_DEPLOYMENT: Returns only dedicated deployment usage data. Filters the response to include only usage from dedicated deployments.
  • TRAINING: Returns only training job usage data (SFT/DPO token usage and RFT / service-mode trainer GPU-seconds usage). Inference deployments serving rollouts for RFT / online RL are reported under DEDICATED_DEPLOYMENT (not TRAINING) to avoid double counting GPU time.
Available options:
USAGE_TYPE_UNSPECIFIED,
SERVERLESS,
DEDICATED_DEPLOYMENT,
TRAINING
timezone
string

IANA timezone identifier for daily aggregation (e.g., "America/Los_Angeles", "Europe/London"). When specified, the returned data will be aggregated into daily buckets based on this timezone. If not specified or empty, defaults to "UTC". See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

groupBy
string[]

Dimensions to group usage by (multiple values allowed; each is a separate GROUP BY column). Each returned bucket carries the requested dimension values in the group map on the response item. Serverless: "model_name", "api_key_id", "api_key_name", "annotations.team", "annotations.project", "annotations.environment". Dedicated: "deployment_name", "accelerator_type", and the same annotation keys. Training: "job_id", "job_type", "usage_type", "accelerator_type", "base_model", and the same annotation keys. When usage_type is unspecified, dimensions that apply only to one stream are ignored on the others (e.g. "deployment_name" is ignored for serverless and training; "model_name" / "api_key_id" / "api_key_name" are ignored for dedicated and training; "job_id" / "job_type" are ignored for serverless and dedicated). Example: ["annotations.team", "model_name"] or ["api_key_id", "api_key_name"]. If empty: serverless aggregates by model name; dedicated defaults to deployment and accelerator type; training aggregates by job_id, job_type, usage_type, accelerator_type and base_model.

Maximum array length: 5
filter
object

Filter usage by dimension. Map query parameter — encode each entry as filter[<dimension>][values]=<value>, repeating the same key to OR multiple values for a single dimension. Serverless: "model_name", "api_key_id", "api_key_name", "annotations.team", "annotations.project", "annotations.environment". Dedicated: "deployment_name", "accelerator_type", and the same annotation keys. Training: "job_id", "job_type", "usage_type", "accelerator_type", "base_model", and the same annotation keys. Example: filter[api_key_name][values]=prod-key&filter[api_key_name][values]=staging-key.

Response

200 - application/json

A successful response.

serverlessCosts
List of serverless cost data · object[]
dedicatedCosts
List of dedicated deployment cost data · object[]