spring-projects / spring-projects/spring-ai

Feature Request: customize OpenAi response rate-limit parsing

Open
#4,276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.