Bug description
When using the OpenAI chat model with Spring AI 2.0.0, the rate-limit metadata returned by ChatResponse is always an instance of EmptyRateLimit.
The completion, model metadata, and token usage are populated correctly, but the OpenAI rate-limit response headers do not appear to be mapped to ChatResponseMetadata.
I believe rate-limit metadata was available in earlier Spring AI 2.0.0 milestone versions, possibly up to 2.0.0-M1, but it is no longer available in the final 2.0.0 release.
Environment
Spring AI: 2.0.0
OpenAI chat model
Model: gpt-5-mini-2025-08-07
Java: 21
Steps to reproduce
ChatResponse chatResponse = chatClient.prompt()
.user("Which country has the largest population in Europe?")
.call()
.chatResponse();
log.info("completion = {}", chatResponse.getResult().getOutput().getText());
log.info("model = {}", chatResponse.getMetadata().getModel());
var usage = chatResponse.getMetadata().getUsage();
log.info("usage = {}", usage);
var rateLimit = chatResponse.getMetadata().getRateLimit();
log.info("rateLimit = {}", rateLimit);
The completion, model, and usage information are returned correctly.
model = gpt-5-mini-2025-08-07
usage = DefaultUsage{
promptTokens=20,
completionTokens=655,
totalTokens=675,
cacheReadInputTokens=0
}
rateLimit = org.springframework.ai.chat.metadata.EmptyRateLimit@24eecabf
chatResponse.getMetadata().getRateLimit() always returns EmptyRateLimit.
Expected behavior
The OpenAI rate-limit response headers should be mapped to ChatResponseMetadata, allowing request and token limits, remaining values, and reset times to be accessed through getRateLimit().
Bug description
When using the OpenAI chat model with Spring AI 2.0.0, the rate-limit metadata returned by ChatResponse is always an instance of EmptyRateLimit.
The completion, model metadata, and token usage are populated correctly, but the OpenAI rate-limit response headers do not appear to be mapped to ChatResponseMetadata.
I believe rate-limit metadata was available in earlier Spring AI 2.0.0 milestone versions, possibly up to 2.0.0-M1, but it is no longer available in the final 2.0.0 release.
Environment
Spring AI: 2.0.0
OpenAI chat model
Model: gpt-5-mini-2025-08-07
Java: 21
Steps to reproduce
The completion, model, and usage information are returned correctly.
chatResponse.getMetadata().getRateLimit() always returns EmptyRateLimit.
Expected behavior
The OpenAI rate-limit response headers should be mapped to
ChatResponseMetadata, allowing request and token limits, remaining values, and reset times to be accessed throughgetRateLimit().