Integrate DeepSeek AI Assistant into IntelliJ IDEA for Java Development
This guide walks Java developers through preparing the environment, installing the CodeGPT plugin, configuring DeepSeek with an API key, and using the AI assistant for code generation, completion, explanation, and token usage monitoring within IntelliJ IDEA.
Introduction
In early 2025, AI tools surged in China, and DeepSeek quickly became popular among developers. Integrating DeepSeek into IntelliJ IDEA provides Java developers with an intelligent coding assistant that boosts productivity.
1. Environment Preparation
IDEA Version Compatibility
Use IntelliJ IDEA 2023.x or newer. Install the CodeGPT plugin, an AI‑driven code assistant that serves as an alternative to GitHub Copilot and similar tools.
Python Environment
DeepSeek requires Python 3.7 or higher. After installation, add Python to the system PATH so the plugin can locate it.
<code>Macbook:GithubCommitSpace Aion$ python --version
Python 3.12.8
Macbook:GithubCommitSpace Aion$</code>2. Install and Configure DeepSeek
Install the AI Code Assistant Plugin
Open IDEA, go to
Settings(Windows/Linux) or
IntelliJ IDEA → Preferences(macOS), select
Plugins, search for
CodeGPTin the Marketplace, and install it.
Create and Set API Key
Visit
https://www.deepseek.com/, open the API Open Platform, and generate an API key. In IDEA, locate the DeepSeek settings and paste the key.
IDEA Integration Settings
In the CodeGPT settings, open
Custom OpenAIand configure three sections:
API Key : paste the DeepSeek API key.
Chat Model : set URL to
https://api.deepseek.com/chat/completionsand model name to
deepseek-chat.
Inference Model : enable
Enable code completionsand
Parse response as Chat Completions, choose FIM template
DeepSeek Coder, set URL to
https://api.deepseek.com/chat/completions, and model name to
deepseek-reasoner.
3. Using DeepSeek for Programming
Generate Ideas and Code
Select the CodeGPT component, choose
Custom OpenAI, and enter a prompt such as “Write a Java method that filters digits and provide a test.” The assistant returns the following code:
<code>public class TestNumberFilter {
public static String filterNumbers(String input) {
// Use regex to keep only digits
return input.replaceAll("[^0-9]", "");
}
public static void main(String[] args) {
String testInput2 = "SSFSDFS结论萨芬122432的噶大都是4无人区是14认识832safsss";
String result = filterNumbers(testInput2);
System.out.println("Filtered numbers: " + result); // Output: 122432414832
}
}</code>Code Completion
While typing, press
Ctrl + Space(or a custom shortcut) and DeepSeek suggests the next code segment.
Code Explanation
Select a code block, right‑click, and choose
CodeGPTto receive a detailed explanation of its logic.
Ask Questions
Highlight code or describe an issue, then select “CodeGPT: Ask Question” to get targeted solutions.
4. DeepSeek Usage Statistics
Token consumption can be viewed on the DeepSeek website. The following screenshots show daily usage and cost breakdown for the
deepseek-chatmodel.
Conclusion
Following these steps integrates DeepSeek into IntelliJ IDEA, allowing Java developers to benefit from AI‑assisted coding, code completion, explanation, and troubleshooting.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.