Use the same DGrid API key that made the original model request. Billing records are scoped to the authenticated key and cannot be queried across keys.
Endpoint
| Authentication | Authorization: Bearer <DGRID_API_KEY> |
| Request | Query parameter |
| Response | application/json |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request_id | string | Yes | The ID of the completed Model API request whose billing details you want to retrieve. |
Get the request ID
DGrid returns the request ID in theDGrid-Request-ID response header of the original model call. Store this value if you need to retrieve the request’s billing details later.
Request example
Response
200 OK
The billing record was found and belongs to the authenticated API key.Billing fields
| Field | Description |
|---|---|
model | Model ID used by the original request. |
input_tokens / output_tokens | Token counts charged for prompt and generated output. |
cache_create_tokens / cache_read_tokens | Cache-related token counts when cache pricing applies. |
input_cost / output_cost | USD cost attributed to input and output token usage. |
cache_create_cost / cache_read_cost | USD cost attributed to cache creation and cache reads. |
request_cost | Fixed per-request USD cost when the pricing mode includes one. |
total_cost | Final USD cost billed for the request. |
pricing_snapshot | The pricing configuration used at billing time. Later price changes do not modify this historical record. |
Best practices
- Save
DGrid-Request-IDwith your own request logs so you can reconcile usage later. - Treat
pricing_snapshotas an immutable historical record for the request. - All cost and price fields are denominated in USD.
- Numeric values may contain variable decimal precision. Do not rely on fixed-width decimal formatting.

