Setup Guide
Get started with Codehere in minutes. Configure your API key and start coding faster.
Quick Start
1. Install Codehere
npm install -g codehere2. Set your API key
export COHERE_API_KEY="your-api-key-here"3. Index your repository
codehere index4. Start using Codehere
codehere "explain this function"API Key Configuration
Getting a Cohere API Key
Codehere uses Cohere's API for code understanding and generation. You'll need a Cohere API key to get started.
- Visit Cohere Dashboard
- Sign up or log in to your account
- Navigate to API Keys section
- Create a new API key
- Copy your API key (keep it secure!)
Setting Your API Key
Set your API key as an environment variable. This keeps your key secure and accessible to Codehere.
Linux / macOS
# Add to your ~/.bashrc or ~/.zshrc
export COHERE_API_KEY="your-api-key-here"
# Or set it for the current session
export COHERE_API_KEY="your-api-key-here"Windows (PowerShell)
# Set for current session
$env:COHERE_API_KEY="your-api-key-here"
# Or set permanently
[Environment]::SetEnvironmentVariable("COHERE_API_KEY", "your-api-key-here", "User")Using .env file (Recommended)
Create a .env file in your project root:
COHERE_API_KEY=your-api-key-hereMake sure to add .env to your .gitignore!
Verify Your API Key
Test that your API key is working correctly:
codehere "test"Rate Limits & API Quotas
Understanding API Limits
Cohere offers different API key types with varying rate limits and quotas. Understanding these limits helps you use Codehere effectively.
Trial Keys
- Limited to 1000 API calls per month
- Great for testing and small projects
- Monthly quota resets at the start of each month
- Rate limit errors will appear when quota is exceeded
Production Keys
- Higher rate limits and quotas
- Better for production use and larger projects
- Upgrade available at Cohere Dashboard
Rate Limit Errors
If you encounter rate limit errors, here's what they mean and how to resolve them:
429 Too Many Requests
This error indicates that you've exceeded your API quota or rate limit.
- Trial key limit exceeded: Wait for monthly reset or upgrade to Production key
- Rate limit exceeded: Wait a few minutes and try again
- Codehere will automatically detect these errors and provide helpful messages
Best Practices
- Index your repository once, then reuse the local code index
- Use Codehere for targeted queries rather than bulk operations
- Consider upgrading to a Production key for heavier usage
- Monitor your API usage in the Cohere Dashboard
Troubleshooting
Common Issues
"COHERE_API_KEY not found"
Make sure your API key is set correctly:
echo $COHERE_API_KEY # Should print your API key"API rate limit exceeded"
Your API key has reached its quota. For Trial keys:
- Wait for the monthly quota to reset
- Upgrade to a Production key for higher limits
- Reduce API usage by reusing the local code index
Slow API responses
If API calls are slow:
- Check your internet connection
- Verify your API key is valid and not rate-limited
- Codehere includes automatic retry logic for temporary failures
Security Best Practices
- Never commit API keys to version control - Always use environment variables or
.envfiles (add to.gitignore) - Use separate keys for development and production - This helps you monitor usage and maintain security
- Rotate keys regularly - Update your API keys periodically for better security
- Monitor usage - Check your API usage regularly in the Cohere Dashboard
Ready to get started?
Install Codehere and start shipping faster with AI-powered code assistance.