Skip to content

Conversation

@CLEMENTINATOR
Copy link
Member

Summary

  • Add optional EnableCompression *bool field to InputObject and Request structs
  • Add optional CompressionRate *float64 field to InputObject and Request structs
  • Support compression fields in all input types (string, InputObject, map)
  • Compression fields are serialized with omitempty to avoid sending nil values
  • 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 InputObject, pointer, and map inputs

🤖 Generated with Claude Code

@SachaMorard
Copy link
Member

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

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

- Add optional `EnableCompression *bool` field to `InputObject` and `Request` structs
- Add optional `CompressionRate *float64` field to `InputObject` and `Request` structs
- Support compression fields in all input types (string, InputObject, map)
- Compression fields are serialized with `omitempty` to avoid sending nil values
- 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 struct with InputTokens, SavedTokens, and Rate fields
- Add optional Compression field to SendResponse for root-level compression data
- Add test for response with compression field
- Add test for response without compression field
- 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 force-pushed the add-compression-fields branch from 73f285e to 0a63a90 Compare February 4, 2026 15:41
@CLEMENTINATOR CLEMENTINATOR merged commit d9e0e2e into main Feb 4, 2026
1 check passed
@CLEMENTINATOR CLEMENTINATOR deleted the add-compression-fields branch February 4, 2026 15:45
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