介面 / Usage
GET
/api/usage/requests/{request_id}請求詳情
計費唯讀查詢介面,不是模型生成請求。 價格與線路 ↗
查詢已完成請求的客戶憑據,包含標準化用量維度、計費明細和公開耗時。
路徑參數
參數類型說明
request_idstring
required
同一把 API Key 發起的請求 ID。Lazu 不允許讀取其它 key 的請求詳情。
響應欄位
參數類型說明
idstring
請求 ID。
modelstring
使用者請求的模型或 route 名稱。
usage.measurementobject
nullable
分別表示輸入和輸出用量來源:provider(上游回報)、local_estimate(本地估算)、unavailable(無法確定)。歷史或未分類記錄可能沒有此欄位,缺省不能視為上游實測。
usage.dimensionsobject[]
標準化 usage 維度,例如 input、output、
cache_read、cache_write_5m、
cache_write_1h、cache_miss。
billing.line_itemsobject[]
計費明細。
routingobject
nullable
僅返回公開狀態和耗時,不暴露內部路由決策及供應商身分。
Cache 欄位
OpenAI-compatible 響應裡,cache read 可能出現在
usage.prompt_tokens_details.cached_tokens 或
usage.input_tokens_details.cached_tokens。cache write
只有在上游返回時才會出現。
如果要對帳或排查費用,以請求詳情 API 為準。
相關頁面
curl https://api.lazu.ai/api/usage/requests/req_lazu_01ABCDEF \-H "Authorization: Bearer $LAZU_API_KEY"
請求回執
計費請求完成後,使用網關請求 ID 查詢用量維度、計費明細與耗時。
查看真實請求回執 ↗RESPONSE · 200
{"object": "usage.request","id": "req_lazu_01ABCDEF","created_at": 1765980000,"model": "gpt-4o-mini","endpoint": "/v1/chat/completions","usage": {"prompt_tokens": 1200,"completion_tokens": 300,"total_tokens": 1500,"dimensions": [{ "name": "input", "quantity": 1200, "unit": "token" },{ "name": "cache_read", "quantity": 300, "unit": "token" },{ "name": "output", "quantity": 300, "unit": "token" }]},"billing": {"currency": "USD","amount_microusd": 480,"pricing_version": 3,"line_items": [{"dimension": "input","quantity": 1200,"unit_microusd": 150,"amount_microusd": 180}]},"routing": {"strategy_name": "default","requested_model": "gpt-4o-mini","resolved_model": "gpt-4o-mini","chose_provider": "openai","status_code": 200},"provider_usage": {"family": "openai","raw_fields": { "prompt_tokens": 1200, "completion_tokens": 300 }},"log_id": "log_01ABCDEF"}
ERROR · 429
{"error": {"type": "rate_limit_exceeded","message": "Per-key limit reached. Retry after 12s.","request_id": "req_01ABCDEF"}}
request_id 來源
使用響應標頭X-Lazu-Request-Id、錯誤響應裡的request_id,或 gateway response request ID。Calls api.lazu.ai directly. The key stays in this browser.