Skip to content

Expose OpenAI chat rate limits#6609

Open
juanjuandog wants to merge 2 commits into
spring-projects:mainfrom
juanjuandog:fix/openai-rate-limit-metadata
Open

Expose OpenAI chat rate limits#6609
juanjuandog wants to merge 2 commits into
spring-projects:mainfrom
juanjuandog:fix/openai-rate-limit-metadata

Conversation

@juanjuandog

Copy link
Copy Markdown
Contributor

Fixes #6607.

Chat completions discard the OpenAI SDK response headers, so ChatResponseMetadata exposes EmptyRateLimit for non-streaming calls. This reads the raw response headers and maps the rate-limit values while keeping streaming behavior unchanged.

Tests:

  • ./mvnw.cmd --no-transfer-progress -q -pl models/spring-ai-openai -am -Dtest=OpenAiChatModelTests,OpenAiAudioSpeechModelWithResponseMetadataTests -Dsurefire.failIfNoSpecifiedTests=false test

Fixes spring-projects#6607

Signed-off-by: juanjuandog <212179655+juanjuandog@users.noreply.github.com>
Support OpenAI reset headers such as 1s and 6m0s while preserving numeric seconds.

Signed-off-by: juanjuandog <212179655+juanjuandog@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI rate-limit metadata is always EmptyRateLimit in Spring AI 2.0.0

2 participants