Adds usage tracking + spend tracking + unit testing for pass through anthropic routes
Relevant issues
Type
๐ New Feature
๐ Bug Fix
๐งน Refactoring
๐ Documentation
๐ Infrastructure
โ Test
Changes
[REQUIRED] Testing - Attach a screenshot of any new tests passing locall
If UI changes, send a screenshot/GIF of working UI fixes
Description by Korbit AI
What change is being made?
Add usage tracking and logging for /anthropic passthrough routes in the proxy by introducing a convert_str_chunk_to_generic_chunk function and creating an AnthropicPassthroughLoggingHandler class, which processes Anthropic responses, constructs logging payloads, and integrates them into the existing streaming infrastructure.
Why are these changes being made?
To improve monitoring and understanding of Anthropic API usage by providing detailed logging, to align with existing logging patterns for other endpoints, and to enhance transparency and debugging capabilities for requests passing through the proxy. This refactoring aims to modularize and streamline the passthrough handling, making the logging process more efficient and maintainable.
Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description
Adds usage tracking + spend tracking + unit testing for pass through anthropic routes
Relevant issues
Type
๐ New Feature ๐ Bug Fix ๐งน Refactoring ๐ Documentation ๐ Infrastructure โ Test
Changes
[REQUIRED] Testing - Attach a screenshot of any new tests passing locall
If UI changes, send a screenshot/GIF of working UI fixes
Description by Korbit AI
What change is being made?
Add usage tracking and logging for
/anthropic
passthrough routes in the proxy by introducing aconvert_str_chunk_to_generic_chunk
function and creating anAnthropicPassthroughLoggingHandler
class, which processes Anthropic responses, constructs logging payloads, and integrates them into the existing streaming infrastructure.Why are these changes being made?
To improve monitoring and understanding of Anthropic API usage by providing detailed logging, to align with existing logging patterns for other endpoints, and to enhance transparency and debugging capabilities for requests passing through the proxy. This refactoring aims to modularize and streamline the passthrough handling, making the logging process more efficient and maintainable.