Supported providers
Anthropic Claude
Recommended - Claude 3.7 Sonnet for best results
Google Gemini
Free tier - Gemini 2.0 Flash for development
Anthropic Claude
Claude Sonnet 4 provides the best code completion quality for Polaris.Create an Anthropic account
- Visit console.anthropic.com
- Sign up for an account
- Add billing information (pay-as-you-go)
Generate an API key
- Go to API Keys in the console
- Click Create Key
- Copy your API key (starts with
sk-ant-)
Models used
Polaris uses different Claude models for different features:| Feature | Model | Why |
|---|---|---|
| Suggestions | Claude 3.7 Sonnet | Fast, high-quality completions |
| Quick Edit | Claude 3.7 Sonnet | Accurate code transformations |
| Conversations | Claude Opus 4 | Complex reasoning and planning |
Configuration
The AI provider is configured in API routes:Google Gemini
Gemini 2.0 Flash is a free alternative for development and testing.Create a Google Cloud account
Visit aistudio.google.com and sign in with your Google account.
Model configuration
Gemini uses a single model for all features:Choosing a provider
- Claude (Recommended)
- Gemini (Free tier)
Best for:
- Production use
- Highest quality code suggestions
- Complex refactoring tasks
- Multi-step reasoning
- Pay-as-you-go based on tokens
- ~$0.003 per 1K input tokens (Sonnet)
- ~$0.015 per 1K output tokens (Sonnet)
Switching providers
You can switch between providers without code changes:- Remove the current provider’s API key from
.env.local - Add the new provider’s API key
- Restart your development server
Cost optimization
Rate limits
Claude
- Tier 1: 50 RPM, 40,000 TPM
- Tier 2: 1,000 RPM, 80,000 TPM
- Tier 3: 2,000 RPM, 160,000 TPM
Gemini
- Free tier: 15 RPM, 1,500 requests/day
- Paid tier: 1,000 RPM, 4M tokens/min
Troubleshooting
API key not working
API key not working
Verify your key is correct and has billing enabled (for Claude) or is within rate limits (for Gemini).
Suggestions not appearing
Suggestions not appearing
Check your browser console for errors. Ensure your API key is set and the provider is reachable.
Rate limit exceeded
Rate limit exceeded
For Gemini free tier, you’ve hit the daily limit. Wait 24 hours or upgrade to a paid plan.