Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description There is a problem calling my private cloud OpenAI service using OpenAiApi

Image But using openai4j is normal

Image Using Postman is also normal

Image

Environment 17 17 17 6.2.4 3.4.3 1.0.0-M6 2024.0.0 Steps to reproduce

    @Test
    public void openaiTest() {
        OpenAiApi openAiApi = OpenAiApi.builder()
                .apiKey("")
                .baseUrl("")
                .completionsPath("chat/completions")
                .build();

        try {
            OpenAiApi.ChatCompletionRequest chatRequest = new OpenAiApi.ChatCompletionRequest(
                    Arrays.asList(new OpenAiApi.ChatCompletionMessage("你是谁", OpenAiApi.ChatCompletionMessage.Role.USER))
                    , "DeepSeek-R1", 0.7, true);
            Flux<OpenAiApi.ChatCompletionChunk> chatCompletionChunkFlux = openAiApi.chatCompletionStream(chatRequest);
            System.out.println(chatCompletionChunkFlux.blockLast());
        } catch (WebClientResponseException e) {
            System.err.println(e.getResponseBodyAsString());

            e.printStackTrace();
        }
    }
<dependency>
            <groupId>dev.ai4j</groupId>
            <artifactId>openai4j</artifactId>
            <version>0.17.0</version>
        </dependency>
    @Test
    public void test1() {

        OpenAiClient client = OpenAiClient.builder()
                .baseUrl("")
                .openAiApiKey("")
                .logStreamingResponses()
                .logLevel(LogLevel.DEBUG)
                .logRequests()
                .logResponses()
                // other customizations coming soon!
                .build();

        ChatCompletionRequest request = ChatCompletionRequest.builder()
                .model("DeepSeek-R1")
                .stream(true)
                .addUserMessage("你是谁")
                .temperature(0.7)
                .build();

        client.chatCompletion(request)
                .onResponse(response -> {
                    System.out.println(response.content());
                })
                .onError(error -> {
                    System.out.println("Error: " + error.getMessage());
                })
                .execute();
    }

Expected behavior What problem causes the body to be empty

Minimal Complete Reproducible example Please provide a failing test or a minimal complete verifiable example that reproduces the issue. Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

Comment From: dev-jonghoonpark

@799452017 There are parts of all the images where the IP addresses are not fully obscured. (Just letting you know, just in case.)

Comment From: dev-jonghoonpark

Check the original HTTP request body using the requestInterceptor. And please share the result if you need more help.

related comment: https://github.com/spring-projects/spring-ai/issues/883#issuecomment-2739772323

Comment From: apappascs

here it looks like that you are using DeepSeek-R1 . So may better use the deepseek starter.

<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-starter-model-deepseek</artifactId>
</dependency>

also the dependencies needs to be updated from <spring-ai.version>1.0.0-M6</spring-ai.version> to <version>1.0.0-SNAPSHOT</version>

you are also mentioning openai4j which is not related to spring-ai in any way.

I will recomend you to follow the documentation : https://docs.spring.io/spring-ai/reference/getting-started.html https://docs.spring.io/spring-ai/reference/api/chat/deepseek-chat.html