spring-projects / spring-projects/spring-ai
Feature Request: customize OpenAi response rate-limit parsing
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
OpenRouter uses X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset headers to return current RateLimit. Current OpenAi client does not support those headers, so it will be best to support custom RateLimit header parsers.
Expected Behavior
Custom RateLimit parser should be supported for OpenAi client, so it can be adapted for OpenRouter responses.
Current Behavior
RateLimit header parsing is hardcoded at OpenAiResponseHeaderExtractor, so to change RateLimit new client should be created.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading OpenAiResponseHeaderExtractor and trace how the OpenAi client obtains rate-limit values from response headers. Determine an extension point for custom parsing, then verify that the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers used by OpenRouter can be supported without creating a separate client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100