DeepSeek4j 1.4: Java Spring Boot Integration for DeepSeek with Full Chain‑of‑Thought and Streaming Support
DeepSeek4j 1.4 introduces a Java‑centric, Spring Boot‑compatible framework that fully preserves DeepSeek's chain‑of‑thought capabilities, adds reactive streaming, and provides simple one‑line API integration, addressing previous limitations in mainstream frameworks and offering ready‑to‑use configuration and code examples.
DeepSeek R1 is popular among developers for its powerful chain‑of‑thought ability, but mainstream frameworks such as Spring AI lack sufficient support, especially for chain‑of‑thought content retention and streaming output.
The newly released DeepSeek4j 1.4 version brings important updates to overcome these limitations.
Project address:
https://github.com/pig-mesh/deepseek4j
Documentation address:
https://javaai.pig4cloud.com/deepseek
Why DeepSeek4j is needed?
DeepSeek4j is a DeepSeek model integration framework built specifically for the Java ecosystem, offering a concise and elegant API that requires only a single line of code to integrate DeepSeek.
Limitations of existing frameworks
Chain‑of‑thought content loss: The core reasoning process of R1 is completely ignored.
Incompatible response mode: Unable to handle "think first, conclude later" output patterns.
Parameter restrictions: Key parameters such as temperature and top_p become ineffective.
Streaming handling is incomplete: User experience is suboptimal.
Solution
The author of the open‑source project Pig, based on the excellent architecture of OpenAI4J, created an out‑of‑the‑box solution dedicated to DeepSeek—DeepSeek4j.
Enhanced support for DeepSeek’s unique chain‑of‑thought and billing features.
Comprehensive reactive support via Project Reactor.
Provides a Spring Boot Starter for automatic configuration.
Core Features
Full preservation of chain‑of‑thought capabilities and billing.
Reactive streaming processing.
Simple and elegant API design.
Plug‑and‑play Spring Boot integration supporting 2.x / 3.x.
Built‑in debugging page.
Detailed request‑response logging.
Flexible proxy configuration.
Support for reactive programming.
Quick Start
Add dependency:
<dependency>
<groupId>io.github.pig-mesh.ai</groupId>
<artifactId>deepseek-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>Configuration parameters:
Add the following to application.yml :
deepseek:
api-key: your-api-key-here
base-url: https://api.deepseek.com/v1 # optional, defaults to official API, supports Volcano, Gitee, Silicon FlowBasic usage:
@Autowired
private DeepSeekClient deepSeekClient;
// SSE streaming response
@GetMapping(value = "/chat", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ChatCompletionResponse> chat(String prompt) {
return deepSeekClient.chatFluxCompletion(prompt);
}Frontend debugging:
Double‑click the sse.html file in the project root to open the debugging page. Enter the backend SSE endpoint URL, click Send, and you can view the reasoning process and final result in real time. The page provides complete frontend implementation code for reference.
Source: Internet
Backend Exclusive Technical Group
Build a high‑quality technical community; developers, recruiters, and anyone interested are welcome to join, share job referrals, and help each other grow.
Maintain civil discourse, focusing on technical exchange , job referrals , and industry discussion .
Advertisers stay away; do not trust private messages to avoid scams.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.