Pollinations.ai Codex - AI Coding Assistant for VS Code
Pollinations.ai Codex is a powerful AI-driven assistant for Visual Studio Code, bringing intelligent coding features powered exclusively by Pollinations.ai. It offers a modern chat panel, project-wide context understanding, syntax-highlighted responses, and smart code insights.
✨ Features
🤖 Intelligent AI Chat Interface
- Modern sidebar chat panel with Cursor.com-style design
- Real-time conversations with AI about your code
- Project context awareness - understands your entire codebase
- Markdown rendering with syntax highlighting
- Message history within sessions
- Dynamic model selection - switch between different AI models on-the-fly
⚡ Smart Code Completion
- Inline code suggestions with ghost text
- Context-aware predictions based on project structure
- Multi-line completions for functions and blocks
- Debounced requests for optimal performance
- Intelligent caching to reduce API calls
🔧 Code Actions & Refactoring
Access powerful AI-driven actions through the lightbulb menu:
- 💡 Explain Selection - Get detailed explanations of code
- 🔧 Refactor Selection - Improve code quality and readability
- 🐛 Find Bugs - Detect potential issues and vulnerabilities
- 📚 Add Documentation - Auto-generate comments and documentation
- ✅ Generate Tests - Create comprehensive unit tests
- ⚡ Optimize Performance - Enhance code efficiency
- 🎯 Generate from Comments - Turn natural language comments into code
🎮 Command Palette Integration
Full integration with VS Code's command palette:
Ctrl+1 - Open AI Chat panel
Ctrl+2 - Explain selected code
Ctrl+3 - Refactor selected code
Ctrl+4 - Find bugs in code
Ctrl+5 - Add documentation
Ctrl+6 - Generate unit tests
Ctrl+7 - Optimize performance
Ctrl+8 - Generate code from comments
🏗️ Advanced Context Understanding
- Comprehensive project analysis - scans all open files
- Language detection and import analysis
- Automatic file tree building for project structure
- Smart prioritization of relevant files
- Caching system for improved performance
🚀 Quick Start
2. Configuration
Get an API key from Pollinations.ai (recommended, free tier)
Configure in VS Code Settings:
{
"pollinationsAI.apiKey": "your-api-key-here",
"pollinationsAI.apiUrl": "https://enter.pollinations.ai/api/generate/v1",
"pollinationsAI.model": "claude-large"
}
Or use Settings UI: Ctrl+, → Search "pollinationsAI"
3. Start Using
- Press
Ctrl+1 (Cmd+1 on Mac) to open AI Chat
- Start typing in any file to get inline completions
- Select code and press
Ctrl+. for code actions
- Use keyboard shortcuts for quick access
🎯 Keyboard Shortcuts
| Shortcut |
Action |
Platform |
Ctrl+1 |
Open AI Chat |
Windows/Linux |
Cmd+1 |
Open AI Chat |
Mac |
Ctrl+2 |
Explain Selection |
Windows/Linux |
Cmd+2 |
Explain Selection |
Mac |
Ctrl+3 |
Refactor Code |
Windows/Linux |
Cmd+3 |
Refactor Code |
Mac |
Ctrl+4 |
Find Bugs |
Windows/Linux |
Cmd+4 |
Find Bugs |
Mac |
Ctrl+5 |
Add Documentation |
Windows/Linux |
Cmd+5 |
Add Documentation |
Mac |
Ctrl+6 |
Generate Tests |
Windows/Linux |
Cmd+6 |
Generate Tests |
Mac |
Ctrl+7 |
Optimize Performance |
Windows/Linux |
Cmd+7 |
Optimize Performance |
Mac |
Ctrl+8 |
Generate from Comment |
Windows/Linux |
Cmd+8 |
Generate from Comment |
Mac |
📋 Usage Examples
Example 1: Explain Code
// 1. Select code you want to understand
const fibonacci = (n) => n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2);
// 2. Press Ctrl+2 or click "Explain" in code actions
// 3. View detailed explanation in new editor window
Example 2: Refactor Code
// 1. Select inefficient code
function slowLoop() {
for (let i = 0; i < array.length; i++) {
console.log(array[i]);
}
}
// 2. Press Ctrl+3
// 3. Code is replaced with optimized version
// Create a function that fetches user data from API
// 1. Type the comment above
// 2. Press Ctrl+8
// 3. AI generates the implementation
Example 4: Generate Tests
function add(a, b) {
return a + b;
}
// 1. Select function
// 2. Use code action "Generate Tests"
// 3. New test file with comprehensive tests opens
Example 5: Ask AI Chat
User: "How do I optimize React components?"
AI: "Here are the best practices for React optimization:
- Use React.memo for functional components
- Implement useMemo for expensive calculations
- Lazy load components with React.lazy...
[Full detailed response with code examples]"
🏗️ Architecture
Core Components
- Extension.ts - Main entry point and service initialization
- AIService - Handles all AI operations (explain, refactor, test generation, etc.)
- ContextService - Gathers and analyzes project context
- OpenAIClient - Manages API communication with configurable models
- CursorStyleChatPanel - Modern chat interface with model selection
- EnhancedCompletionProvider - Provides inline code suggestions
- CodeActionProvider - Implements lightbulb menu actions
Supported AI Models
- Claude Large (default) - Anthropic's advanced model
- Claude - Standard Claude model
- OpenAI GPT - OpenAI's GPT series
- Gemini Search - Google's Gemini with search capabilities
⚙️ Configuration
All settings in VS Code Settings (Ctrl+,):
| Setting |
Type |
Default |
Description |
pollinationsAI.apiKey |
string |
"" |
Your API key (required) |
pollinationsAI.apiUrl |
string |
"https://..." |
Custom API endpoint |
pollinationsAI.model |
string |
"claude-large" |
AI model to use |
pollinationsAI.enableAutocomplete |
boolean |
true |
Enable AI autocomplete |
🛠️ Troubleshooting
API Key Issues
Problem: "API Key not configured"
Solution:
1. Ctrl+, → Search "pollinationsAI.apiKey"
2. Paste your API key
3. Restart VS Code
Completion Not Working
Problem: No inline suggestions appear
Solution:
1. Check API key is configured
2. Ensure file is saved and active
3. Try waiting 1-2 seconds before typing (cache load)
4. Check in DevTools (F12) for errors
Chat Not Responding
Problem: Chat messages not getting responses
Solution:
1. Check API key in settings
2. Check network connection
3. Monitor API quota/rate limits
4. Restart extension: Cmd+Shift+P → "Developer: Reload Window"
📄 License
MIT License - Free for personal and commercial use
🔗 Resources
Made with ❤️ for developers. Happy coding! 🚀