Integrating DeepSeek AI Assistant into IntelliJ IDEA: A Step‑by‑Step Guide
This tutorial explains how to prepare the environment, install the CodeGPT plugin, configure DeepSeek API keys and model settings in IntelliJ IDEA, and use the AI assistant for code generation, completion, explanation, and troubleshooting, while also showing usage statistics and a complete Java example.
The article introduces DeepSeek, an AI‑driven code assistant, and explains why integrating it into IntelliJ IDEA can greatly improve Java development productivity.
1. Environment preparation – Use IntelliJ IDEA 2023.x or newer and install the CodeGPT plugin (a powerful alternative to GitHub Copilot). Ensure Python 3.7+ is installed and added to the system PATH.
Macbook:GithubCommitSpace Aion$ python --version
Python 3.12.8
Macbook:GithubCommitSpace Aion$2. Install DeepSeek plugin – Open IDEA, go to Settings (Windows/Linux) or IntelliJ IDEA → Preferences (macOS), select Plugins → Marketplace , search for "CodeGPT", and install it. Restart IDEA after installation.
3. Configure DeepSeek
Create an API key on the DeepSeek website ( https://www.deepseek.com/ ).
In IDEA, open the CodeGPT settings, locate the "Custom OpenAI" section, and paste the API key.
Set the chat model URL to https://api.deepseek.com/chat/completions and model name to deepseek-chat .
For the reasoning model, enable code completions, parse response as chat completions, choose the FIM template "DeepSeek Coder", set the same URL, and use model deepseek-reasoner .
After configuring, click Apply and OK.
4. Using DeepSeek
Open the CodeGPT component, select "Custom OpenAI", and type a prompt such as "Write a Java method to filter numbers and provide a test".
The assistant generates the following 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: 123456
}
}Code completion can be triggered with Ctrl + Space , and code explanation or question answering is available via right‑click context menu options "CodeGPT" and "CodeGPT: Ask Question".
5. Token usage statistics – The article shows screenshots of DeepSeek’s token consumption dashboard, illustrating daily usage, total tokens, and cost for the deepseek-chat model.
Conclusion – By following these steps, developers can successfully integrate DeepSeek into IntelliJ IDEA, leverage AI‑assisted coding features, and monitor usage, thereby enhancing development efficiency and experience.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
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.