Skip to main content
GET
Get usage

Per-call headers

Send x-predev-project-id: <projectId> on a request to attribute it to one of the workspace’s projects. Ids of projects the workspace does not own are ignored.

Usage totals

GET /v1/usage returns totals for the last days days (1 to 90, default 30), broken down by model and path. The read is not charged.

One generation

GET /v1/generation?id=<id> returns the record of one call, using the pdg-… id from the response body, or from a stream chunk once the stream ends. Only this workspace’s generations are visible. Stats can take a few seconds to appear after a call; a 404 with code not_ready means retry shortly.
The body’s data object reports the model, timing (latency, generation_time), finish_reason, whether the call streamed or was cancelled, token counts including reasoning and cached tokens, counts of images and other attachments, and credits: the credits charged for the call.

Authorizations

Authorization
string
header
required

The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.

Headers

x-predev-project-id
string

Attribute this call to one of the workspace's projects. An id the workspace does not own is ignored.

Query Parameters

days
integer
default:30

Window length. Values outside 1 to 90 are clamped.

Required range: 1 <= x <= 90

Response

Usage totals.

workspace
string
required

An opaque, stable id for the workspace the key belongs to (a personal account or a team).

Pattern: ^ws_[0-9a-f]{16}$
project
string | null
required

The project from x-predev-project-id when the workspace owns it, else null. The totals always cover the whole workspace.

credits_remaining
number | null
required

Current balance. null on plans without a credit limit.

tier
string
required

Plan tier, for example Trial or SoloPro.

since
string<date-time>
required

Start of the window.

totals
object
required
by_model
object[]
required

One row per model and endpoint, most credits first.