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
But using openai4j is normal
Using Postman is also normal
Environment
@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 openaiTest() {
OpenAiApi openAiApi = OpenAiApi.builder()
.apiKey("sk-1605216e65cd4f7c85bee30d15f54cf6")
.baseUrl("http://1.95.200.239:2025/v1/")
.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();
}
}
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.