Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
介面 / Usage
GET/api/usage/requests/{request_id}

請求詳情

計費唯讀查詢介面,不是模型生成請求。 價格與線路

查詢已完成請求的客戶憑據,包含標準化用量維度、計費明細和公開耗時。

路徑參數

參數類型說明
request_id
string
required

同一把 API Key 發起的請求 ID。Lazu 不允許讀取其它 key 的請求詳情。

響應欄位

參數類型說明
id
string

請求 ID。

model
string

使用者請求的模型或 route 名稱。

usage.measurement
object
nullable

分別表示輸入和輸出用量來源:provider(上游回報)、local_estimate(本地估算)、unavailable(無法確定)。歷史或未分類記錄可能沒有此欄位,缺省不能視為上游實測。

usage.dimensions
object[]

標準化 usage 維度,例如 inputoutputcache_readcache_write_5mcache_write_1hcache_miss

billing.line_items
object[]

計費明細。

routing
object
nullable

僅返回公開狀態和耗時,不暴露內部路由決策及供應商身分。

Cache 欄位

OpenAI-compatible 響應裡,cache read 可能出現在

usage.prompt_tokens_details.cached_tokensusage.input_tokens_details.cached_tokens。cache write 只有在上游返回時才會出現。

如果要對帳或排查費用,以請求詳情 API 為準。

相關頁面

CodePOST https://api.lazu.ai
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.