latestOpenAPI 3.1.02026-08-197104501.1 MB

8fbaab4fc7c5

Budget & Spend Tracking

View Spend Logs

[DEPRECATED] This endpoint is not paginated and can cause performance issues. Please use /spend/logs/v2 instead for paginated access to spend logs.

View all spend logs, if request_id is provided, only logs for that request_id will be returned

When start_date and end_date are provided:

  • summarize=true (default): Returns aggregated spend data grouped by date (maintains backward compatibility)
  • summarize=false: Returns filtered individual log entries within the date range

Example Request for all logs

curl -X GET "http://0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234"

Example Request for specific request_id

curl -X GET "http://0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234"

Example Request for specific api_key

curl -X GET "http://0.0.0.0:8000/spend/logs?api_key=sk-test-example-key-123" -H "Authorization: Bearer sk-1234"

Example Request for specific user_id

curl -X GET "http://0.0.0.0:8000/spend/logs?user_id=ishaan@berri.ai" -H "Authorization: Bearer sk-1234"

Example Request for date range with individual logs (unsummarized)

curl -X GET "http://0.0.0.0:8000/spend/logs?start_date=2024-01-01&end_date=2024-01-02&summarize=false" -H "Authorization: Bearer sk-1234"
get/spend/logs

Query parameters

api_keystring nullable

Get spend logs based on api key

Get spend logs based on api key

user_idstring nullable

Get spend logs based on user_id

Get spend logs based on user_id

request_idstring nullable

request_id to get spend logs for specific request_id. If none passed then pass spend logs for all requests

request_id to get spend logs for specific request_id. If none passed then pass spend logs for all requests

start_datestring nullable

Time from which to start viewing key spend

Time from which to start viewing key spend

end_datestring nullable

Time till which to view key spend

Time till which to view key spend

summarizeboolean

When start_date and end_date are provided, summarize=true returns aggregated data by date (legacy behavior), summarize=false returns filtered individual logs

When start_date and end_date are provided, summarize=true returns aggregated data by date (legacy behavior), summarize=false returns filtered individual logs

Response

Successful Response

request_idstring required
api_keystring required
modelstring nullable
api_basestring nullable
call_typestring required
spendnumber nullable
total_tokensinteger nullable
prompt_tokensinteger nullable
completion_tokensinteger nullable
userstring nullable
{"stackTrail":"components:schemas:LiteLLM_SpendLogs:properties:metadata:anyOf","oasType":"schema","type":"unknown","title":"Metadata","nullable":true}
cache_hitstring nullable
cache_keystring nullable
{"stackTrail":"components:schemas:LiteLLM_SpendLogs:properties:request_tags:anyOf","oasType":"schema","type":"unknown","title":"Request Tags","nullable":true}
requester_ip_addressstring nullable