Ui View Spend Logs
View spend logs with pagination support. Available at both /spend/logs/v2 (public API) and /spend/logs/ui (internal UI).
Returns paginated response with data, total, page, page_size, and total_pages.
Example:
curl -X GET "http://0.0.0.0:8000/spend/logs/v2?start_date=2025-11-25%2000:00:00&end_date=2025-11-26%2023:59:59&page=1&page_size=50" -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
request_id to get spend logs for specific request_id
Filter spend logs by session_id (partial string match)
Filter spend logs by session_id (partial string match)
Filter spend logs by team_id
Filter spend logs by team_id
Filter logs with spend greater than or equal to this value
Filter logs with spend greater than or equal to this value
Filter logs with spend less than or equal to this value
Filter logs with spend less than or equal to this value
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
Page number for pagination
Page number for pagination
Number of items per page
Number of items per page
Filter logs by status (e.g., success, failure)
Filter logs by status (e.g., success, failure)
Filter logs by cache state: 'hit' or 'miss'. Miss includes legacy rows with a null/unknown cache state
Filter logs by cache state: 'hit' or 'miss'. Miss includes legacy rows with a null/unknown cache state
Filter logs by model
Filter logs by model
Filter logs by model ID (litellm model deployment id)
Filter logs by model ID (litellm model deployment id)
Filter logs by model group
Filter logs by model group
Filter logs by key alias
Filter logs by key alias
Filter logs by end user
Filter logs by end user
Filter logs by error code (e.g., '404', '500')
Filter logs by error code (e.g., '404', '500')
Filter logs by error message (partial string match)
Filter logs by error message (partial string match)
Sort logs by field: spend, total_tokens, startTime, endTime, request_duration_ms, model, or ttft_ms
Sort logs by field: spend, total_tokens, startTime, endTime, request_duration_ms, model, or ttft_ms
Sort order: asc or desc
Sort order: asc or desc
Exclude LiteLLM internal health check requests from results
Exclude LiteLLM internal health check requests from results
Paginate over sessions instead of raw logs: one representative row per session, total counts sessions
Paginate over sessions instead of raw logs: one representative row per session, total counts sessions
Keyset cursor '<last_activity>|<api_key>|<session_key>' from a previous group_by_session page. UI route only, honored when sorting by startTime
Keyset cursor '<last_activity>|<api_key>|<session_key>' from a previous group_by_session page. UI route only, honored when sorting by startTime
Match a log whose request_id, api_key (hash), team_id, user, end_user, session_id, or model_id equals this value. request_id matches across all time; the other columns match inside start_date/end_date, which stay required
Match a log whose request_id, api_key (hash), team_id, user, end_user, session_id, or model_id equals this value. request_id matches across all time; the other columns match inside start_date/end_date, which stay required
Response
Successful Response
Changes
Changed in 1 of the 42 revisions of this API.10
- ○
added the new optional
queryrequest parametercache_hit_filternew-optional-request-parameter
- ○
added the new optional
queryrequest parameterexclude_internal_health_checksnew-optional-request-parameter
- ○
added the new optional
queryrequest parametergroup_by_sessionnew-optional-request-parameter
- ○
added the new optional
queryrequest parametermodel_groupnew-optional-request-parameter
- ○
added the new optional
queryrequest parametersearchnew-optional-request-parameter
- ○
added the new optional
queryrequest parametersession_cursornew-optional-request-parameter
- ○
added the new optional
queryrequest parametersession_idnew-optional-request-parameter
- ○
for the
queryrequest parameterpage_size, the max was increased from100.00to1000.00request-parameter-max-increased
- ○
added the optional property
//to the response with the statusresponse-optional-property-added
- ○
added the optional property
//to the response with the statusresponse-optional-property-added
This revision also has 5 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ○