Skip to content

Conversation

@CLEMENTINATOR
Copy link
Member

Summary

  • Add optional enable_compression?: boolean field to InputObject interface
  • Add optional compression_rate?: number field to InputObject interface
  • Include compression fields in request body for both send() and stream() methods
  • Compression fields are omitted from request when not provided
  • Fields are gateway-internal and not sent to providers

Test plan

  • Verify compression fields are included in request body when provided
  • Verify compression fields are omitted when not provided
  • Test with both send() and stream() methods

🤖 Generated with Claude Code

@CLEMENTINATOR CLEMENTINATOR requested a review from a team as a code owner February 3, 2026 16:56
@SachaMorard
Copy link
Member

@CLEMENTINATOR Do you want to add the compression response field in another PR?

CLEMENTINATOR and others added 3 commits February 4, 2026 16:11
Add support for compression configuration with optional fields that can be
passed per request to override API key settings.

- Add optional `enable_compression?: boolean` field to `InputObject` interface
- Add optional `compression_rate?: number` field to `InputObject` interface
- Include compression fields in request body for both `send()` and `stream()` methods
- Compression fields are omitted from request when not provided
- Fields are gateway-internal and not sent to providers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add compression interface with input_tokens, saved_tokens, and rate fields
- Add optional compression field to SendResponse for root-level compression data
- Update SendResponse constructor to accept compression parameter
- Add test for response with compression field
- Add test for response without compression field
@CLEMENTINATOR CLEMENTINATOR force-pushed the add-compression-fields branch from b9d7086 to e76dd98 Compare February 4, 2026 15:11
- Add example showing how to access compression data in responses
- Add compression info to features list
- Add example showing how to enable compression and set compression rate
- Demonstrate accessing compression metrics from response
- Show usage information alongside compression data
- Add substantial AI history document as context (~3000+ chars)
- Demonstrate meaningful compression on large input
- Show percentage of tokens saved
- Explain that compression works on input tokens
- Only USER messages are compressed, not system messages
- Update example to put context in user message
- Add clarifying comment about compression behavior
@CLEMENTINATOR CLEMENTINATOR merged commit de0dfd2 into main Feb 4, 2026
1 check passed
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