79814815

Date: 2025-11-09 13:53:28
Score: 1
Natty:
Report link

I got around the problem in the following way:

@Bean
public OpenAiApi openAiApi() {
    HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
    JdkClientHttpRequestFactory jdkClientHttpRequestFactory = new JdkClientHttpRequestFactory(httpClient);

    return OpenAiApi.builder()
      .apiKey(this.apiKey)
      .baseUrl(this.baseUrl)
      .restClientBuilder(
        RestClient.builder()
          .requestFactory(jdkClientHttpRequestFactory)
      ).build();
};

Credits to: https://github.com/spring-projects/spring-ai/issues/2653#issuecomment-2783528029

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Marcel