/api/v1/generationGet cost and tokens for one request
Looks up one settled request of your organization. The id is gen-<request_id>; the bare request id (the x-request-id response header) is also accepted. A request of another organization reads as unknown (404). streamed, finish_reason and generation_time are derived from recorded latency and terminal status. This 404 uses the {detail} envelope.
認証: AuthorizationヘッダーにBearer形式のAPIキー
クエリパラメータ
idstring必須Generation id (
gen-<request_id>) or the bare request id.
レスポンス
200The generation's metadata.
レスポンス
dataobject必須data
idstringgen-<request_id>.total_costnumberCharged credits plus the attributed estimate of your own provider key, USD.
usagenumberSame value as total_cost, USD.
modelstringModel slug as called.
provider_namestringProvider that served it; empty when nothing was dispatched.
streamedbooleanTrue when a first token was observed.
cancelledbooleanfinish_reasonstring | nullstopfor a completed request, else the failure class or status.latencyinteger | nullTotal latency, ms.
generation_timeinteger | nullLatency minus time to first token, ms.
tokens_promptintegertokens_completionintegernative_tokens_promptinteger | nullnative_tokens_completioninteger | nullnative_tokens_reasoninginteger | nullnative_tokens_cachedinteger | nullupstream_inference_costnumber | nullList-price estimate of a request on your own provider key, USD; null for platform-funded requests.
cache_discountnumber | nullAlways null.
401Missing, unknown or revoked API key.
レスポンス
errorstring必須Human-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
404No settled request of your organization has this id.
レスポンス
detailstring必須
422The body or query failed validation.
レスポンス
detailarray<object>必須detail
typestringlocarray<string | integer>msgstring
リクエスト
curl https://api.experientiallabs.ai/api/v1/generation?id=gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734 \
-H "Authorization: Bearer YOUR_API_KEY"レスポンス
{
"data": {
"id": "gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734",
"total_cost": 0.004215,
"usage": 0.004215,
"model": "claude-opus-5.5",
"provider_name": "anthropic",
"streamed": true,
"cancelled": false,
"finish_reason": "stop",
"latency": 6120,
"generation_time": 5310,
"tokens_prompt": 1840,
"tokens_completion": 402,
"native_tokens_prompt": 1840,
"native_tokens_completion": 402,
"native_tokens_reasoning": 0,
"native_tokens_cached": 1024,
"upstream_inference_cost": null,
"cache_discount": null
}
}https://api.experientiallabs.ai/api/v1/generation?id=gen-req_7c1e4b2a9f0d4e3c8a51b6d2f0e9a734