api::handlers::batches

Get batch analytics

Retrieve aggregated metrics for a batch including token usage, costs, and latency statistics.

Analytics update in real-time as requests complete.

get/batches/{batch_id}/analytics

Path parameters

batch_idstring required

The batch ID returned when the batch was created.

Response

Batch analytics with token counts, costs, and performance metrics.

avg_duration_msnumber double nullable

Average request duration in milliseconds

avg_ttfb_msnumber double nullable

Average time to first byte in milliseconds

total_completion_tokensinteger required

Total completion tokens across all requests

total_coststring nullable

Total BILLED cost in credits (if pricing is available) — what the batch actually cost after prompt-cache discounts, matching the credits ledger / transactions page. (Until 2026-07 this field erroneously reported the un-discounted list price; see total_list_cost for that figure.)

total_list_coststring nullable

Un-discounted list price of the same requests (no prompt-cache discounts applied). total_list_cost - total_cost = what caching saved on this batch. Additive field — clients that don't know it simply ignore it.

total_prompt_tokensinteger required

Total prompt tokens across all requests

total_reasoning_tokensinteger nullable

Total reasoning tokens across all requests

total_requestsinteger required

Total number of requests with analytics data

total_tokensinteger required

Total tokens (prompt + completion) across all requests

Example response

{
  "avg_duration_ms": 1250.5,
  "avg_ttfb_ms": 150.2,
  "total_completion_tokens": 25000,
  "total_cost": "0.75",
  "total_list_cost": "1.50",
  "total_prompt_tokens": 50000,
  "total_requests": 100,
  "total_tokens": 75000
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.