Endpoints
Generation lookup
Look up the cost, token counts, provider and metadata of a past request with GET /generation, using the generation id from the response.
Look up the details of a past request (its exact cost, token counts, provider, latency and finish reason) by its generation id. Useful for reconciling bills, auditing streamed requests and debugging slow calls.
GET https://api14.com/api/v1/generation?id={generation_id}
Where to find the id
- The
idfield of a chat completion, completion or response (gen-...). - The
X-Generation-Idresponse header, when present. - The
idin the first chunk of a stream. - The Usage page of your dashboard.
Request
| Query parameter | Required | Description |
|---|---|---|
id | yes | The generation id. |
curl "https://api14.com/api/v1/generation?id=gen-1791100000-abc123" \
-H "Authorization: Bearer sk-api14-..."
You can only look up generations made by your own account. Any other id (or an id that was never logged) returns 404 not_found.
Response
The body is the generation record:
{
"data": {
"id": "gen-1791100000-abc123",
"model": "anthropic/claude-sonnet-4.5",
"created_at": "2026-10-04T09:12:44Z",
"provider_name": "Anthropic",
"streamed": true,
"finish_reason": "stop",
"tokens_prompt": 1250,
"tokens_completion": 340,
"native_tokens_prompt": 1310,
"native_tokens_completion": 352,
"native_tokens_reasoning": 0,
"native_tokens_cached": 1024,
"latency": 412,
"generation_time": 3810,
"total_cost": 0.00918
}
}
| Field | Description |
|---|---|
total_cost | The amount debited from your balance, in USD. |
native_tokens_* | Token counts from the provider's own tokenizer, these are what you are billed for. |
native_tokens_cached | Prompt tokens served from cache. See Prompt caching. |
latency / generation_time | Time to first token and total generation time, in ms. |
Cost
total_cost (and usage.cost in the original response) is your charge for the request, the same amount shown on the Usage page. See Pricing & billing.
Timing
The record can take a few seconds to appear after a request finishes. If you get a 404 right after a request, retry after a short delay.
Errors
| Status | Code | When |
|---|---|---|
| 401 | invalid_api_key | Missing or invalid key. |
| 404 | not_found | The id is unknown or belongs to another account. |
| 502 | upstream_unavailable | The record could not be fetched; retry. |
See Errors.