Ga naar inhoud

Prudai Developer API: gebruik

Het gebruik van je organisatie per periode.

Basis-URL https://api.prudai.com/v1. Inloggen staat in Inloggen, scopes in Scopes en rechten, fouten in Fouten. Overzicht.

MethodePadWat het doetStand
GET/v1/usageGebruik opvragenOp productie

Gebruik opvragen

GET /v1/usage

Aggregated usage.

Usage of all keys of your organisation in the same environment as the calling key (live keys see live usage, test keys see test usage), aggregated per UTC day, key, model and/or operation. Contains metadata only, never content. Credit amounts are null until credit accounting is enabled; free operations then cost 0. Source grouping and filtering are reserved and return 422 unsupported_parameter until source metadata is recorded. Personal credentials require an Owner or Admin role.

  • Stand: op productie.
  • Scope: account:usage:read
  • Goedkeuring: none, geen extra stap.

Parameters

  • start_date query · string (date) verplicht
    First UTC day (inclusive).
  • end_date query · string (date)
    Last UTC day (inclusive). Defaults to today. The range is at most 366 days.
  • group_by query · array<string>
    Dimensions to group by, comma-separated. Default day. The reserved source dimension returns 422 unsupported_parameter. Een van: day, key, model, operation, source
  • key_id query · string
    Only usage of this key. Public id of an API key (not the secret). patroon ^key_[A-Za-z0-9]{20}$
  • model query · string
    Only usage of this model (product or product/specialisation). A product, optionally followed by / and a specialisation slug (e.g. leo/arbeidsrecht). max. lengte 80 · patroon ^(leo|leo-fiscaal|zia|vera|bever|maia)(/[a-z0-9]+(-[a-z0-9]+)*)?$
  • operation query · string
    Only usage of this operation. The metered manifest operation identifier. Legacy dotted operation names are accepted as filters. patroon ^[A-Za-z][A-Za-z0-9_.-]{0,99}$
  • source_id query · string
    Reserved source filter. Currently returns 422 unsupported_parameter. Public source id from the Prudai source catalogue. max. lengte 80 · patroon ^[a-z0-9]+(-[a-z0-9]+)*$

Antwoorden

StatusBetekenis
200The usage report.
401Missing, malformed, unknown, expired or revoked key, or a key used against the wrong environment.
403Authenticated, but not allowed (missing scope, product not on the key or organisation, organisation suspended, Developer API switched off for the organisation, IP not on the allowlist, depth not permitted, licence does not permit redistribution).
422Well-formed request with invalid values (for example an unknown reasoning_effort, empty messages, or an Idempotency-Key reused with a different body).
429Rate limit, concurrency limit, Ultra daily quota or fair-use limit of the free sources operations exceeded.
500Unexpected error on Prudai’s side. Not charged, except work that completed before the failure (reported in details.charged_credits).

Velden in data (200)

  • object string
    usage.report
  • start_date string (date)
  • end_date string (date)
  • group_by array<string>
    Een van: day, key, model, operation, source
  • data array<UsageBucket>
  • data[].date string (date)
    Set when grouped by day. kan null zijn
  • data[].key_id string
    Set when grouped by key. kan null zijn
  • data[].key_name string
    kan null zijn
  • data[].model string
    Set when grouped by model (null for operations without a model, such as search). kan null zijn
  • data[].operation string
    Set when grouped by operation. kan null zijn
  • data[].source_id string
    Set when grouped by source. kan null zijn
  • data[].requests integer
    min. 0
  • data[].failed_requests integer
    min. 0
  • data[].input_tokens integer
    min. 0
  • data[].cached_input_tokens integer
    min. 0
  • data[].output_tokens integer
    min. 0
  • data[].reasoning_tokens integer
    min. 0
  • data[].priced_tool_calls integer
    min. 0
  • data[].source_requests integer
    min. 0
  • data[].credits number
    Null while credit accounting is disabled or the metered amount is unavailable. kan null zijn
  • totals UsageCounters
  • totals.requests integer
    min. 0
  • totals.failed_requests integer
    Requests that ended in an error (not charged unless partial work was charged). min. 0
  • totals.input_tokens integer
    min. 0
  • totals.cached_input_tokens integer
    min. 0
  • totals.output_tokens integer
    min. 0
  • totals.reasoning_tokens integer
    min. 0
  • totals.priced_tool_calls integer
    min. 0
  • totals.source_requests integer
    /sources/* and /citations/verify requests (free at launch, counted here). min. 0
  • totals.credits number
    Null while credit accounting is disabled or the metered amount is unavailable. kan null zijn
curl
curl -s "https://api.prudai.com/v1/usage?start_date=%3Cstart_date%3E" \
-H "Authorization: Bearer $PRUDAI_TOKEN"
CLI (binnenkort)
prudai leo usage
Antwoord 200
{
"object": "usage.report",
"start_date": "2026-11-05",
"end_date": "2026-11-05",
"group_by": [
"day"
],
"data": [
{
"date": "2026-11-05",
"key_id": "string",
"key_name": "string",
"model": "leo",
"operation": "listModels",
"source_id": "string",
"requests": 1,
"failed_requests": 1,
"input_tokens": 1,
"cached_input_tokens": 1,
"output_tokens": 1,
"reasoning_tokens": 1,
"priced_tool_calls": 1,
"source_requests": 1,
"credits": 1
}
],
"totals": {
"requests": 1,
"failed_requests": 1,
"input_tokens": 1,
"cached_input_tokens": 1,
"output_tokens": 1,
"reasoning_tokens": 1,
"priced_tool_calls": 1,
"source_requests": 1,
"credits": 1
}
}