-
Copy the template:
cp .env.template .env
-
Add your API keys to
.env -
Start the server:
./run.sh
- Go to: https://platform.openai.com/api-keys
- Sign in or create an account
- Click "Create new secret key"
- Copy the key (starts with
sk-proj-orsk-) - Add to
.env:OPENAI_API_KEY=sk-proj-your-actual-key-here
Example formats:
- New:
sk-proj-Ab12Cd34Ef56Gh78Ij90Kl12Mn34Op56Qr78St90Uv12Wx34 - Legacy:
sk-Ab12Cd34Ef56Gh78Ij90Kl12Mn34Op56Qr78
- Go to: https://console.anthropic.com/settings/keys
- Sign in or create an account
- Click "Create Key"
- Copy the key (starts with
sk-ant-api03-) - Add to
.env:ANTHROPIC_API_KEY=sk-ant-api03-your-actual-key-here
Example format:
sk-ant-api03-Ab12Cd34Ef56Gh78Ij90Kl12Mn34Op56Qr78St90Uv12Wx34Yz56Ab78Cd90Ef12Gh34Ij56Kl78Mn90Op12Qr34St56Uv78Wx90
- Go to: https://makersuite.google.com/app/apikey
- Sign in with your Google account
- Click "Create API Key"
- Copy the key (starts with
AIzaSy) - Add to
.env:GOOGLE_API_KEY=AIzaSyYour-Actual-Key-Here
Example format:
AIzaSyAb12CdEf34GhIj56KlMn78OpQr90StUv12WxYz34
DEFAULT_PROVIDER: Which LLM provider to use when not specified in requests
- Options:
openai,anthropic,google - Default:
openai
DEFAULT_MODEL: Which model to use when not specified in requests
-
OpenAI options:
gpt-4o- Latest GPT-4 Optimized (recommended)gpt-4o-mini- Faster, cheaper GPT-4 (recommended for most use cases)gpt-4-turbo- Previous generation GPT-4gpt-3.5-turbo- Older, cheaper option
-
Anthropic options:
claude-3-5-sonnet-20241022- Latest Claude 3.5 (recommended)claude-3-opus-20240229- Most capable, slowerclaude-3-haiku-20240307- Fastest, cheapest
-
Google options:
gemini-1.5-pro- Most capable Gemini (recommended)gemini-1.5-flash- Faster, cheapergemini-pro- Previous generation
CACHE_MAX_SIZE: Maximum number of cached responses
- Default:
1000 - Increase for more caching, decrease for less memory usage
CACHE_TTL_SECONDS: How long to keep cached responses
- Default:
3600(1 hour) - Common values:
300- 5 minutes1800- 30 minutes3600- 1 hour86400- 24 hours
HOST: Network interface to bind to
0.0.0.0- Listen on all interfaces (default, recommended)127.0.0.1- Listen only on localhost (more secure for local dev)
PORT: Port number for the server
- Default:
8000 - Change if port is already in use
ENVIRONMENT: Deployment environment
development- Development mode (default, enables hot reload)staging- Staging environmentproduction- Production mode
OPENAI_API_KEY=sk-proj-your-key-hereOPENAI_API_KEY=sk-proj-your-openai-key
ANTHROPIC_API_KEY=sk-ant-api03-your-anthropic-key
GOOGLE_API_KEY=AIzaSy-your-google-key
DEFAULT_PROVIDER=anthropic
DEFAULT_MODEL=claude-3-5-sonnet-20241022OPENAI_API_KEY=sk-proj-your-key-here
DEFAULT_PROVIDER=openai
DEFAULT_MODEL=gpt-4o-mini
CACHE_MAX_SIZE=5000
CACHE_TTL_SECONDS=7200
HOST=0.0.0.0
PORT=8000
ENVIRONMENT=productionOPENAI_API_KEY=sk-proj-your-key-here
DEFAULT_MODEL=gpt-4o-mini
CACHE_MAX_SIZE=500
CACHE_TTL_SECONDS=300
ENVIRONMENT=development- Make sure
.envfile exists in the project root - Check that the API key variable name is correct (all caps, with underscores)
- Verify there are no extra spaces around the
=sign - Ensure the key starts with the correct prefix
- Double-check you copied the entire key
- Make sure the key hasn't been revoked
- Verify you're using the correct provider's key
- Check if port 8000 is already in use:
lsof -i :8000 - Try changing the PORT in
.env - Make sure virtual environment is activated
- Verify
CACHE_MAX_SIZEis greater than 0 - Check
CACHE_TTL_SECONDSis reasonable (not too small) - View cache stats at: http://localhost:8000/api/health
✅ DO:
- Keep
.envfile private (it's in.gitignore) - Use different API keys for development and production
- Rotate API keys regularly
- Set spending limits on provider dashboards
❌ DON'T:
- Commit
.envto version control - Share API keys in chat/email
- Use production keys in development
- Expose API keys in client-side code
- OpenAI Docs: https://platform.openai.com/docs
- Anthropic Docs: https://docs.anthropic.com
- Google AI Docs: https://ai.google.dev/docs
- Project README: See
README.md - Quick Start: See
QUICKSTART.md