Repolode
pig-mesh

pig-mesh/deepseek4j

A Java SDK for the DeepSeek API, with chat, function calling, structured JSON output, embeddings, and a Spring Boot starter.

Stars
750
Forks
142
Open issues
16
Last commit
13 days ago

What is it?

deepseek4j is a Java SDK for calling the DeepSeek API. It covers chat completions with reasoning output, function calling, JSON structured output, and embedding generation through an OpenAI-compatible protocol. The default model is DeepSeek Flash, and DeepSeek V4 Pro can be selected through configuration or per request.

For Spring Boot 2.x and 3.x projects, a starter module auto-configures the client from application.yml or application.properties, and streaming responses are exposed as Reactor Flux values for SSE endpoints. The core module can also be used without Spring by creating a client with DeepSeekClient.builder(). Solon is listed as a supported framework.

The SDK also wraps DeepSeek's official Search API for structured web results, and provides a helper that searches first and then streams a model answer grounded in those results.

Key features

  • 01Chat completions with reasoning output and session billing data
  • 02Function calling and JSON structured output
  • 03Embedding generation via OpenAI-compatible API
  • 04Spring Boot starter with auto-configured client and streaming support
  • 05Official DeepSeek Search API wrapper with sync and async calls
  • 06Configurable proxy, timeouts, and request/response logging

Use cases

  • Adding DeepSeek chat features to a Spring Boot backend
  • Streaming model answers to a browser over server-sent events
  • Calling DeepSeek from a plain Java application without Spring
  • Building search-grounded answers from official web search results

Quick start

  1. 1

    Add the Maven dependency (Spring Boot starter, or deepseek4j-core without Spring Boot)

  2. 2

    Set your DeepSeek API key in application.yml under deepseek.api-key

  3. 3

    Inject DeepSeekClient and call chatFluxCompletion(prompt) to stream a reply

Things to know

  • Requires a DeepSeek API key to call the service.
  • Most detailed documentation is in Chinese.
  • Version 1.6.0 contains breaking search API changes, so upgrading from 1.5.0 needs code updates.

Topics

FAQ

What is deepseek4j?
A Java SDK for the DeepSeek API, with chat, function calling, structured JSON output, embeddings, and a Spring Boot starter. deepseek4j is a Java SDK for calling the DeepSeek API. It covers chat completions with reasoning output, function calling, JSON structured output, and embedding generation through an OpenAI-compatible protocol. The default model is DeepSeek Flash, and DeepSeek V4 Pro can be selected through configuration or per request.
Is deepseek4j free to use? What license does it have?
deepseek4j is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is deepseek4j still maintained?
Actively maintained. The last commit to deepseek4j was on Oct 25, 2026.
What can I use deepseek4j for?
Adding DeepSeek chat features to a Spring Boot backend Streaming model answers to a browser over server-sent events Calling DeepSeek from a plain Java application without Spring Building search-grounded answers from official web search results
How do I install deepseek4j?
Add the Maven dependency (Spring Boot starter, or deepseek4j-core without Spring Boot) Set your DeepSeek API key in application.yml under deepseek.api-key Inject DeepSeekClient and call chatFluxCompletion(prompt) to stream a reply
Where can I get deepseek4j?
The source code and installation instructions are on GitHub: https://github.com/pig-mesh/deepseek4j

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects