Production integration docs · examples use router-api.mengbi-ai.net and a personal API key placeholder.
Inspect request usage
Use request-level records to verify the model, input and output tokens, cache usage, and final cost.
Request record fields
The personal console shows the model and billing details for each request. Check your balance and key status before making API calls.
request_id
model
input_tokens
output_tokens
cache_tokens
cost
upstream_status_code
error_code
upstream_request_idTroubleshoot a 502
- Save the requestId from the response, then inspect upstream_status_code and error_code in usage records.
- upstream_status_code=402 means the upstream account is out of balance; 401/403 means an upstream key or permission issue; 404 means a path or model mismatch.
- If the URL contains /v1/v1, remove the duplicate /v1 from the client Host or Base URL. For 429, wait for Retry-After before retrying.
How to read billing records
One Agent task can include several model requests, and model changes can create separate price records.
Cached tokens
Cache-hit tokens use the model’s current published cache price. Retries or split tasks may create multiple billing entries.
Estimated versus final cost
A client-side estimate may differ from the final cost. Use the completed request’s token totals and price snapshot as the source of truth.