Get generation metadata

GET/v1/generation

Get request, provider, usage, timing, token, and cost metadata for a generation. This endpoint works across recorded model requests, including text, vision, image, video, audio, and other generation types when metadata is available.

Use X-Trace-ID from the original model response headers as the generation lookup ID. If X-Trace-ID and X-Request-ID differ, this endpoint uses X-Trace-ID. Do not use the response body id such as chatcmpl_....

Authentication

Authorization Bearer

API key as bearer token in Authorization header.

Query Parameters

idstringrequired

X-Trace-ID from the original model response. If X-Trace-ID and X-Request-ID differ, use X-Trace-ID, not the response body id.

Response

dataobject

Generation metadata.

data.idstring

Generation or request ID.

data.request_idstring | null

Request correlation ID when available.

data.api_typestring | null

API family used by the generation, such as completions, image, video, tts, or stt.

data.modelstring | null

Model used for the generation.

data.model_typestring | null

Internal model category, such as llm, image, video, or audio.

data.statusstring | null

Recorded generation status, such as completed, failed, cancelled, or processing.

data.created_atstring | null

ISO 8601 creation timestamp.

data.updated_atstring | null

ISO 8601 update timestamp.

data.generation_timenumber | null

Generation time in milliseconds when known.

data.latencynumber | null

End-to-end request latency in milliseconds when known.

data.provider_idstring | number | null

Route ID used for the request.

data.provider_request_idstring | null

Upstream request or response identifier.

data.tokens_promptinteger | null

Prompt token count when available.

data.tokens_completioninteger | null

Completion token count when available.

data.total_costnumber | null

Total recorded generation cost in USD.

data.usagenumber | null

Usage amount in USD.

data.streamedboolean | null

Whether the original response was streamed.

data.cancelledboolean | null

Whether the generation was cancelled.

data.finish_reasonstring | null

Reason the generation finished when reported.

Errors

  • 400: Missing required id query parameter.
  • 401: Missing or invalid Authorization.
  • 404: Generation not found, or it is not accessible with the authenticated API key.

Request

Shell
1curl "https://api.token360.ai/v1/generation?id={request_id}" \
2  -H "Authorization: Bearer sk-your-api-key"

Response

JSON
1{
2  "data": {
3    "id": "550e8400-e29b-41d4-a716-446655440000",
4    "request_id": "550e8400-e29b-41d4-a716-446655440000",
5    "api_type": "completions",
6    "model": "glm-5.1",
7    "model_type": "llm",
8    "status": "completed",
9    "created_at": "2026-06-02T08:00:00Z",
10    "updated_at": "2026-06-02T08:00:02Z",
11    "generation_time": 1820,
12    "latency": 1820,
13    "provider_id": "42",
14    "provider_request_id": "provider_resp_123",
15    "tokens_prompt": 128,
16    "tokens_completion": 256,
17    "total_cost": 0.00042,
18    "usage": 0.00042,
19    "streamed": false,
20    "cancelled": false,
21    "finish_reason": "stop"
22  }
23}
Was this page helpful?