Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
按天 / 按模型的花费汇总。console usage 图表的数据源。
model
/me/billing/transactions
curl 'https://llm.bytespike.ai/api/v1/me/usage?since=2026-05-01&until=2026-05-22&group_by=day' \ -H "Authorization: Bearer $BYTESPIKE_API_KEY"
since
until
group_by
day
hour
api_key
?group_by=day,model
id
group_by=day
{ "buckets": [ { "bucket": "2026-05-21", "total_usd": 4.18, "input_tokens": 142000, "output_tokens": 18400, "call_count": 312 }, { "bucket": "2026-05-20", "total_usd": 3.94, "input_tokens": 134800, "output_tokens": 17220, "call_count": 298 } // … ], "totals": { "total_usd": 78.42, "input_tokens": 2580000, "output_tokens": 332000, "call_count": 5824 } }
group_by=day,model
{ "buckets": [ { "bucket": "2026-05-21", "model": "claude-sonnet-4-6", "total_usd": 2.10, "input_tokens": 88000, "output_tokens": 11200, "call_count": 142 }, { "bucket": "2026-05-21", "model": "gpt-5-4", "total_usd": 1.74, "input_tokens": 42000, "output_tokens": 5800, "call_count": 96 } // … ], "totals": { /* same shape */ } }
buckets[].bucket
buckets[].total_usd
buckets[].input_tokens
buckets[].output_tokens
buckets[].call_count
totals
error.type
invalid_request_error
authentication_error
import requests, os, datetime today = datetime.date.today() since = today.replace(day=1).isoformat() r = requests.get( "https://llm.bytespike.ai/api/v1/me/usage", params={"since": since, "group_by": "model"}, headers={"Authorization": f"Bearer {os.environ['BYTESPIKE_API_KEY']}"}, timeout=10, ).json() for b in sorted(r["buckets"], key=lambda x: -x["total_usd"]): print(f"{b['model']:30s} ${b['total_usd']:8.2f} {b['call_count']} calls")