1e929292ddd5
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"
Query parameters
Get spend logs based on api key
Get spend logs based on api key
Get spend logs based on user_id
Get spend logs based on user_id
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
Time from which to start viewing key spend
Time from which to start viewing key spend
Time till which to view key spend
Time till which to view key spend
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