/api/v1/generationInspect the upstream provider, usage.cost, cost_details, and generation content. A null cost can be used for later reconciliation.
Back to Credits and usage endpoint listRequest parameters
| Field | Type | Required | Description |
|---|---|---|---|
query.id | string | Yes | query parameters。 |
Response fields
| Field | Type | Required | Description |
|---|---|---|---|
data | object | No | See the OpenAPI schema for field details. |
data.id | string | No | See the OpenAPI schema for field details. |
data.model | string | No | See the OpenAPI schema for field details. |
data.provider_name | string | No | See the OpenAPI schema for field details. |
data.usage | Usage | No | usage.cost is the upstream cost fact when present, including 0. GR billing may apply local discounts when writing final cost. |
Errors
401
UNAUTHORIZEDMissing or invalid Authorization Bearer token.
403
FORBIDDENThe current API key is not authorized for this scope, model, or management capability.
422
VALIDATION_ERRORThe request body, path parameters, or query parameters do not match the endpoint schema.
Notes
- Use a GlobalRouter API key; upstream OpenRouter API keys are never exposed to tenants.
- If OpenRouter explicitly returns usage.cost as 0, treat it as 0; do not fall back to a local price estimate.
- upstream_inference_prompt_cost and upstream_inference_completions_cost in cost_details usually provide a breakdown; usage.cost is the authoritative total.