How to Set Up OpenAI Codex in JetBrains IDE: Complete Installation Guide
I wanted to use OpenAI Codex directly in my JetBrains IDE for code generation and intelligent suggestions. But when I first tried to set it up, I kept searching in the wrong places - trying to find a standalone “OpenAI Codex plugin” instead of using the official JetBrains AI Assistant.
Here’s what I learned through trial and error.
The Problem: External AI Tools Break My Flow
I was tired of switching between my IDE and ChatGPT in a browser window. Every time I needed code suggestions or explanations, I had to:
- Copy code from the IDE
- Paste it into ChatGPT
- Read the response
- Copy the result back
- Paste it into my IDE
This back-and-forth was killing my productivity. I wanted AI-powered code assistance directly inside my JetBrains IDE.
The Solution: JetBrains AI Assistant Plugin
JetBrains officially integrated OpenAI’s Codex model into their IDEs through the AI Assistant plugin. This provides:
- Code generation and auto-completion
- Intelligent suggestions based on your codebase
- Chat interface right in the IDE
- Context-aware responses
Here’s exactly how I set it up.
Step 1: Install the AI Assistant Plugin
First, open your JetBrains IDE (IntelliJ IDEA, PyCharm, WebStorm, etc.) and navigate to the plugin marketplace:
Settings/Preferences (Ctrl+Alt+S / Cmd+,) → Plugins → Marketplace → Search: "JetBrains AI Assistant"Click the Install button and restart your IDE when prompted.
I initially made the mistake of searching for “OpenAI Codex” or “ChatGPT” - those are third-party plugins and not the official integration. The official one is called “AI Assistant” by JetBrains.
Step 2: Sign In with OpenAI Account
After restarting, you’ll see a new AI Assistant icon in the top-right corner of your IDE window.
Click it and select “Sign in Codex with ChatGPT”:
1. Click AI Assistant icon (top-right corner)2. Select "Sign in Codex with ChatGPT"3. Browser opens for OpenAI authentication4. Enter your OpenAI credentials5. Authorize JetBrains AI Assistant6. Return to IDE - you're now connected!If you don’t have an OpenAI account yet, you can create one during this process.
Step 3: Using Codex Features
Once connected, you can access Codex features in several ways:
Chat with AI
Press Alt+Enter (Windows/Linux) or Opt+Enter (macOS) on any code to ask questions:
// Select code and press Alt+Enterpublic List<Document> processFiles(String path) { // Ask: "Explain what this method does" // Ask: "Add error handling" // Ask: "Optimize this method"}Code Generation
Use the AI Assistant tool window (View → Tool Windows → AI Assistant) to generate code:
Generate a REST controller for a Spring Boot applicationthat handles CRUD operations for a User entity with:- username (String)- email (String)- createdAt (LocalDateTime)Inline Completion
As you type, AI Assistant will suggest completions based on Codex’s understanding of your codebase context. Press Tab to accept suggestions.
Free vs Paid Tiers
Here’s what I discovered about the pricing:
| Feature | Free Tier | Paid Plan |
|---|---|---|
| Model Access | Limited models | Full model access |
| Monthly Queries | Limited quota | Higher quota |
| Code Completion | Basic suggestions | Advanced context-aware |
| Chat History | Session only | Persistent |
Free users can access basic Codex features with limited models and a monthly query quota. For heavy daily use, the paid plan unlocks full capabilities.
Common Mistakes I Made
Mistake 1: Wrong Plugin
I initially installed a third-party “ChatGPT for JetBrains” plugin instead of the official AI Assistant. These unofficial plugins often:
- Have compatibility issues
- Don’t integrate with IDE context properly
- May have security concerns with your API keys
Solution: Only use the official “AI Assistant” plugin by JetBrains.
Mistake 2: Using Wrong Credentials
I tried logging in with my JetBrains account instead of my OpenAI account.
The AI Assistant requires an OpenAI account for Codex access, not your JetBrains license account.
Mistake 3: Expecting Full Features on Free Tier
I was frustrated when some features were grayed out until I realized the free tier has limitations.
Solution: Check your usage in the AI Assistant settings and consider upgrading if you hit limits frequently.
Troubleshooting Installation Issues
Plugin Not Found in Marketplace
If you can’t find the AI Assistant plugin:
1. Check IDE version: Requires 2023.2 or later2. Update your IDE: Help → Check for Updates3. Refresh plugin repository: Settings → Plugins → ⚙️ → RefreshAuthentication Fails
If OpenAI authentication doesn’t complete:
1. Check firewall/proxy settings2. Clear IDE caches: File → Invalidate Caches3. Try signing out and back in4. Verify OpenAI account is active at platform.openai.comNo AI Icon Visible
If the AI Assistant icon doesn’t appear:
View → Tool Windows → AI AssistantORSettings → Tools → AI Assistant → EnableWhy This Matters for Developers
Native IDE integration provides significant advantages over external AI tools:
- Context Awareness: The AI understands your entire project structure, not just snippets you paste
- Workflow Integration: No context switching between browser and IDE
- Code Quality: Suggestions match your project’s coding style and patterns
- Time Savings: Seconds saved per interaction add up to hours weekly
For example, when I ask Codex to “add logging to this method,” it knows my project uses SLF4J and follows my logging conventions - something external ChatGPT couldn’t do.
Related Knowledge
- Context Window: AI Assistant sends relevant code context (open files, recently viewed code) to Codex for better suggestions
- Privacy: Code snippets are sent to OpenAI servers for processing; check your organization’s policies for sensitive codebases
- Alternative: GitHub Copilot also integrates with JetBrains IDEs if you prefer that platform
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Setting up OpenAI Codex in JetBrains IDE takes just a few minutes with the official AI Assistant plugin. The key is using the correct plugin name and authenticating with your OpenAI account. Free users get access to basic features, while paid plans unlock the full potential of AI-powered code assistance directly in your development environment.
Comments