Skip to content

Conversation

@AlexsanderHamir
Copy link
Collaborator

Title

[Refactor] Deprecate spend/logs & add spend/logs/v2

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🧹 Refactoring

Changes

  • Reused existing endpoint that contains pagination.
  • Based on the url called parse the date accordingly.

Manual Test Results

Screenshot 2025-11-26 at 4 13 01 PM Screenshot 2025-11-26 at 4 13 18 PM

- Add /spend/logs/v2 endpoint that shares implementation with /spend/logs/ui
- Provides paginated access to spend logs with comprehensive filtering
- Replaces non-paginated /spend/logs endpoint to prevent performance issues
- Both v2 and ui endpoints share the same function for consistency
- Add flexible date parsing for v2 endpoint (supports both YYYY-MM-DD and YYYY-MM-DD HH:MM:SS)
- Keep strict timestamp format for /spend/logs/ui endpoint for backward compatibility
- Parse dates based on which endpoint was called using request path
- Mark /spend/logs as deprecated in docstring
- Direct users to use /spend/logs/v2 for paginated access
- Warns about performance issues with non-paginated endpoint
@vercel
Copy link

vercel bot commented Nov 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Nov 27, 2025 0:23am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants