AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Configuring Code GPT in IntelliJ IDEA: Custom LLM Providers and Multi-Module Project Indexing

矢嶋雄基 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Enterprise backend engineers frequently assume that modern AI coding assistants belong exclusively to Visual Studio Code, treating JetBrains IDEs as second-class citizens. When working with IntelliJ IDEA on complex multi-module Maven or Gradle architectures, developers often get boxed into proprietary solutions like JetBrains AI Assistant or GitHub Copilot, both of which restrict model choice and enforce rigid cloud data pipelines.

Code GPT breaks this constraint. Operating inside IntelliJ IDEA (as well as PyCharm, WebStorm, and PhpStorm), Code GPT brings vendor-agnostic LLM integration directly into JetBrains' static analysis ecosystem. At 365Finds, our assessment is straightforward: pairing IntelliJ IDEA's AST engine with Code GPT delivers superior architectural sovereignty. It allows enterprise teams to connect private local runtimes (such as Ollama), internal OpenAI-compatible gateways (vLLM, LiteLLM), or commercial frontier APIs (Claude 3.7 Sonnet, GPT-4o), while indexing multi-module repositories for semantic codebase retrieval.

This guide provides a comprehensive, production-ready walkthrough to install Code GPT in IntelliJ IDEA, configure custom and local providers, and index complex multi-module enterprise projects without exhausting system memory or corrupting context embeddings.


1. System Requirements and Environment Preparation

Before installing the plugin, ensure your development environment satisfies Code GPT's runtime prerequisites:


2. Installing the Code GPT Plugin in IntelliJ IDEA

You can install Code GPT through JetBrains Marketplace or via manual disk archive.

Method A: JetBrains Marketplace (Recommended)

  1. Launch IntelliJ IDEA and open your target project.
  2. Open Settings:
    • macOS: IntelliJ IDEA -> Settings (or Preferences).
    • Windows/Linux: File -> Settings (shortcut: Ctrl + Alt + S).
  3. Select Plugins from the left-hand navigation menu.
  4. Switch to the Marketplace tab, enter CodeGPT in the search field, and locate CodeGPT: Chat & AI Agents (developed by DanielSanMedium / Judini).
  5. Click Install, accept third-party plugin notices, and restart the IDE when prompted.

Method B: Manual Installation from Disk

In air-gapped corporate environments without direct Marketplace access:

  1. Download the plugin archive (.zip) from the official JetBrains Marketplace repository.
  2. In IntelliJ IDEA, navigate to Settings -> Plugins.
  3. Click the gear icon (⚙️) in the upper-right corner and select Install Plugin from Disk....
  4. Choose the downloaded .zip file, confirm installation, and restart IntelliJ IDEA.

Once restarted, a dedicated Code GPT tool window appears on the IDE's right-hand dock.


3. Configuring Custom LLM Providers and API Keys

Code GPT offers three integration models: local private LLMs, custom enterprise completion endpoints, and Bring-Your-Own-Key (BYOK) cloud providers.

Option A: Local Sovereign LLMs via Ollama (Air-Gapped & Zero Telemetry)

For proprietary banking, healthcare, or internal enterprise backends where source code cannot traverse external networks, local execution is mandatory.

  1. Install and Run Ollama: Ensure Ollama is installed and running on your local workstation or intranet server. By default, its daemon binds to http://localhost:11434.
  2. Pull a Capable Coding Model: Execute the pull command in your terminal:
    ollama pull qwen2.5-coder:14b
    
    365Finds Recommendation: On workstations with 16 GB to 24 GB RAM, qwen2.5-coder:14b strikes the optimal balance between inference speed, context retention, and Java syntax comprehension. On machines equipped with 32 GB+ unified memory or dedicated VRAM, deploy qwen2.5-coder:32b.
  3. Configure Code GPT:
    • Open the Code GPT tool window in IntelliJ IDEA.
    • Click the model selector or settings gear icon.
    • Under the provider category, select Local LLMs and choose Ollama.
    • Specify the server endpoint: http://localhost:11434.
    • Pick your pulled model (qwen2.5-coder:14b) from the model dropdown.
  4. Tune the Context Window (num_ctx): Standard Ollama instances default to a 2,048 or 4,096 token context window, which silently truncates multi-module code retrieved during RAG queries. Create an explicit Ollama Modelfile or configure your model parameters with num_ctx 16384 or num_ctx 32768 to support cross-module snippets.

Option B: Custom OpenAI-Compatible Endpoints (vLLM / LiteLLM Gateways)

Enterprise platform teams often host centralised model instances behind an internal API gateway.

  1. Open the Code GPT tool window settings in IntelliJ IDEA.
  2. In the model selection panel, navigate to LLMs Cloud model and select Custom.
  3. Supply the following fields:
    • Model Name: The exact deployment identifier recognized by your gateway (e.g., hosted-deepseek-coder or corporate-mistral-large).
    • API Key: Your internal bearer token or gateway secret.
    • Endpoint URL: The full completion route, such as https://ai-gateway.internal.corp/v1/chat/completions.
  4. Click Connect. Code GPT securely retains credentials in IntelliJ IDEA's local secure credential store.

Option C: Cloud Providers via BYOK (Bring Your Own Key)

If your corporate data policy allows public cloud inference with commercial Data Processing Agreements (DPAs):

  1. In the Code GPT settings panel, select providers like Anthropic, OpenAI, Google AI Studio, or DeepSeek.
  2. Enter your personal or organization API key.
  3. Select your target frontier model (e.g., Claude 3.7 Sonnet or GPT-4o).

4. Indexing Multi-Module Projects for Project-Wide Context Awareness

Single-file context fails in enterprise architectures. A typical backend system involves multiple subprojects—such as order-service-api, order-service-core, order-service-infrastructure, and common-utils. Code GPT's Codebase Indexing (Augmented Context) scans project source trees, builds a local vector database, and enables semantic search across disparate modules.

Pre-Index Preparation: Clean Build Artifacts

In Maven and Gradle multi-module projects, auto-generated files, compiled bytecode, and dependency caches will corrupt vector indices:

Mandatory Action:

  1. Run a clean build command before indexing:
    # For Maven multi-module:
    mvn clean
    # For Gradle multi-project:
    ./gradlew clean
    
  2. Verify that your root .gitignore excludes target/, build/, .gradle/, .idea/, *.class, and *.jar. Code GPT respects .gitignore rules during workspace scans.

Executing the Indexing Process

  1. Open the Code GPT tool window in IntelliJ IDEA.
  2. In the top navigation bar of the panel, click the Codebase or Augmented Context button.
  3. Click Create Codebase Index (or Select Folder to Index).
  4. Scope Selection:
    • Monolithic Repositories (< 250k lines of code): Select the project root folder. Code GPT scans all child modules recursively.
    • Large Distributed Monorepos (> 50 submodules): Do not index the entire root blindly. Instead, select the primary domain service module along with your core shared library module.
  5. Monitor progress while Code GPT parses syntax trees and generates vector embeddings. The process runs locally without dispatching code to Code GPT servers.

Preventing Out-of-Memory (OOM) Errors in IntelliJ IDEA

Generating embeddings for tens of thousands of classes across multiple modules places significant heap pressure on both the IDE and the embedded Node.js process:

  1. In IntelliJ IDEA, navigate to Help -> Edit Custom VM Options.
  2. Increase your heap ceiling:
    -Xms2048m
    -Xmx8192m
    
  3. Save and restart IntelliJ IDEA before launching a massive indexing job.

5. Querying Multi-Module Logic with @codebase

Once indexed, queries reference cross-module dependencies seamlessly. Prefix your chat prompts with the @codebase tag to trigger semantic retrieval across all indexed modules.

@codebase In order-service-core, explain how OrderCreatedEvent is constructed and trace which listener in notification-service processes it.
@codebase Identify all implementations of PaymentGateway across our submodules and point out any discrepancy in exception handling.
@codebase Where is the JWT authorization filter registered, and how does common-security share authentication claims with customer-api?

The underlying Semantic Search engine identifies relevant method signatures, DTOs, and interface declarations, injecting targeted chunks into the model's prompt context rather than exhausting window limits with whole files.


6. 365Finds Research Judgment and Best Practices

Architecture ChoicePrimary AdvantageMajor Limitation365Finds Institutional Verdict
Local Ollama (qwen2.5-coder:14b)Absolute code privacy; zero external network egress; zero token feesDemands 16 GB+ RAM; slower inference during massive RAG lookupsRecommended for proprietary enterprise code where compliance strictly bans cloud APIs.
Internal vLLM / LiteLLM GatewayPooled enterprise compute; unified access controls; custom model weightsRequires DevOps setup and internal network maintenanceBest choice for mid-to-large engineering orgs standardizing on self-hosted infra.
BYOK Frontier Cloud (Claude 3.7 / GPT-4o)State-of-the-art multi-module reasoning; rapid code generationToken consumption costs; data must clear corporate DPAsRecommended for rapid architectural refactoring when external API compliance is granted.

Operational Rulebook:

  1. Never Re-Index Without Cleaning: Always run mvn clean or ./gradlew clean prior to refreshing the codebase index. Stale .class files and decompiled dependencies will introduce severe hallucinations into semantic search results.
  2. Watch the Port 54112 Collision: If Code GPT displays persistent connection failures or fails to initialize chat, terminate conflicting background Node or Docker instances binding to 54112 or 54113.
  3. Combine Static Analysis with Semantic Search: Code GPT does not replace IntelliJ IDEA's native refactoring engines (e.g., Shift + F6 rename, structural search, type hierarchy). Use Code GPT to understand architectural intent across modules, but rely on IntelliJ's static compiler graph for safety-critical refactoring.

References