CodeSage 🧠
AI-Powered Code Review for VS Code - Works with Ollama, OpenAI, Groq, Gemini, and more!
CodeSage is a lightweight AI developer tool that analyzes your Python code and suggests improvements. It integrates seamlessly into VS Code and works with multiple AI providers - use local AI (Ollama) or cloud APIs (Groq, OpenAI, etc.)
✨ Features
- 🤖 Multiple AI Providers - Choose from Ollama, Groq, OpenAI, Together AI, HuggingFace
- ⚡ Diff Preview - See exact changes before applying
- 🔒 Privacy First - Use local AI (Ollama) for complete privacy
- 💰 Free Options - Groq and Ollama have free tiers
- 🪟 WSL Support - Works perfectly on Windows with WSL
- ⚡ Fast Setup - Install and start using in minutes
🚀 Quick Setup
Step 1: Install CodeSage
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search "CodeSage"
- Click Install
Step 2: Choose Your AI Provider
Option A: Groq (Recommended - Free & Fast)
- Go to console.groq.com and sign up (free)
- Copy your API key
- Go to VS Code Settings (
Ctrl + ,)
- Set:
{
"codesage.provider": "groq",
"codesage.modelName": "llama-3.3-70b-versatile",
"codesage.apiKey": "YOUR_GROQ_API_KEY"
}
Option B: Ollama (Free & Offline)
- Install Ollama from ollama.com
- Download a model:
ollama pull deepseek-coder:6.7b
- Go to VS Code Settings (
Ctrl + ,)
- Set:
{
"codesage.provider": "ollama",
"codesage.modelName": "deepseek-coder:6.7b"
}
Option C: OpenAI (GPT-4)
- Get API key from platform.openai.com
- Go to VS Code Settings
- Set:
{
"codesage.provider": "openai",
"codesage.modelName": "gpt-4o",
"codesage.apiKey": "YOUR_OPENAI_API_KEY"
}
Step 3: Install Dependencies
- Open VS Code terminal (
Ctrl + `)
- Run:
pip3 install typer ollama openai huggingface-hub
Step 4: Start Using!
- Open any Python file
- Right-click → CodeSage: Review Code
- Or press
Ctrl+Shift+P → CodeSage: Review Code
⚙️ Settings Reference
All Settings
| Setting |
Default |
Description |
codesage.provider |
ollama |
AI provider (ollama, groq, openai, togetherai, huggingface) |
codesage.modelName |
deepseek-coder:6.7b |
Model name (depends on provider) |
codesage.apiKey |
(empty) |
API key for cloud providers |
codesage.useWsl |
false |
Enable WSL (for Windows users with WSL) |
Provider Settings
Ollama (Local - Free)
{
"codesage.provider": "ollama",
"codesage.modelName": "deepseek-coder:6.7b"
}
Available Models:
deepseek-coder:6.7b - Fast, efficient (Recommended)
qwen2.5-coder:14b - More accurate
llama3:8b - General purpose
codellama:7b - Code specialized
Install models: ollama pull <model-name>
Groq (Cloud - Free Tier)
{
"codesage.provider": "groq",
"codesage.modelName": "llama-3.3-70b-versatile",
"codesage.apiKey": "gsk_xxxxxxx"
}
Available Models:
llama-3.3-70b-versatile - Fast, accurate (Recommended)
mixtral-8x7b-32768 - Large context
gemma2-9b-it - Lightweight
Sign up: console.groq.com
OpenAI (Cloud - Paid)
{
"codesage.provider": "openai",
"codesage.modelName": "gpt-4o",
"codesage.apiKey": "sk-xxxxxxx"
}
Available Models:
gpt-4o - Most capable
gpt-4o-mini - Fast, cheap
gpt-3.5-turbo - Budget option
Sign up: platform.openai.com
Together AI (Cloud - Free Tier)
{
"codesage.provider": "togetherai",
"codesage.modelName": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"codesage.apiKey": "xxxxxxxxxx"
}
Sign up: api.together.ai
HuggingFace (Cloud - Free Tier)
{
"codesage.provider": "huggingface",
"codesage.modelName": "meta-llama/Llama-3-70b-chat-hf",
"codesage.apiKey": "hf_xxxxxxx"
}
Sign up: huggingface.co
🛠️ Usage
Method 1: Right Click (Recommended)
- Open a Python file
- Right-click anywhere in the editor
- Select CodeSage: Review Code
Method 2: Command Palette
- Press
Ctrl + Shift + P
- Type: CodeSage: Review Code
- Press Enter
Method 3: Keyboard Shortcut (Custom)
Ctrl + Shift + P
- Type: Preferences: Open Keyboard Shortcuts
- Search for "codesage"
- Assign a shortcut like
Ctrl+Shift+R
📊 Provider Comparison
| Provider |
Cost |
Setup |
Speed |
Privacy |
Internet Required |
| Ollama |
Free |
Medium |
Fast (local) |
Full |
No |
| Groq |
Free tier |
Easy |
Very Fast |
None |
Yes |
| OpenAI |
Paid |
Easy |
Fast |
None |
Yes |
| Together AI |
Free tier |
Easy |
Fast |
None |
Yes |
| HuggingFace |
Free tier |
Easy |
Medium |
None |
Yes |
🔧 Troubleshooting
"Dependencies not installed"
Run in VS Code terminal:
pip3 install typer ollama openai huggingface-hub
"Ollama is not running" (for Ollama users)
Run in terminal:
ollama serve
"API Error" (for cloud providers)
- Check your API key is correct
- Check you have credits/quota remaining
- Check the model name is correct for your provider
Setup Dependencies
Run from Command Palette:
Ctrl+Shift+P
- Type: CodeSage: Setup Dependencies
- Press Enter
Open Settings
Run from Command Palette:
Ctrl+Shift+P
- Type: CodeSage: Open Settings
- Press Enter
📝 Example
def add(a,b):
result=a+b
return result
def multiply(x,y):
z=x*y
return z
AI Suggestions
def add(a, b):
+ """Add two numbers."""
result = a + b
return result
def multiply(x, y):
+ """Multiply two numbers."""
z = x * y
return z
🔮 Future Improvements
- Apply Fix Button - One click to apply suggestions
- Inline AI suggestions - See suggestions in editor
- Multi-file code analysis
- Explain code feature
- More language support
👨💻 Author
Bhoopendra Singh Bhadauria
⭐ Support
If you like CodeSage, consider giving it a star on the marketplace!
📄 License
MIT License