We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Generation lookup

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 id field of a chat completion, completion or response (gen-...).
  • The X-Generation-Id response header, when present.
  • The id in the first chunk of a stream.
  • The Usage page of your dashboard.

Request

Query parameterRequiredDescription
idyesThe 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
  }
}
FieldDescription
total_costThe 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_cachedPrompt tokens served from cache. See Prompt caching.
latency / generation_timeTime 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

StatusCodeWhen
401invalid_api_keyMissing or invalid key.
404not_foundThe id is unknown or belongs to another account.
502upstream_unavailableThe record could not be fetched; retry.

See Errors.