CodeDuet supports multiple AI providers for maximum flexibility. Choose the option that best fits your needs:
Run models locally on your machine with no API costs.
Installation:
# Install Ollama (visit https://ollama.ai)
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull llama2 # 7B model, good for most tasks
ollama pull codellama # Optimized for coding
ollama pull mistral # Alternative optionConfiguration:
# Optional - customize settings (defaults work out of the box)
export OLLAMA_BASE_URL="http://localhost:11434"
export OLLAMA_MODEL="llama2"
# Start CodeDuet
codeduetEasy-to-use GUI for running local models.
Installation:
- Download LM Studio from https://lmstudio.ai
- Install and launch the application
- Browse and download a model (e.g., Code Llama, Mistral)
- Start the local server (click "Start Server" in LM Studio)
Configuration:
# Optional - customize settings
export LM_STUDIO_BASE_URL="http://localhost:1234"
export LM_STUDIO_MODEL="your-loaded-model-name"
# Start CodeDuet
codeduetAccess Claude's advanced reasoning capabilities.
Setup:
- Get your API key from Anthropic Console
- Configure environment variables:
export ANTHROPIC_API_KEY="your-api-key-here"
export ANTHROPIC_MODEL="claude-3-sonnet-20240229" # Default, can be customized
export ANTHROPIC_BASE_URL="https://api.anthropic.com" # Default, usually not needed
# Start CodeDuet
codeduetAvailable Models:
claude-3-sonnet-20240229- Balanced performance (recommended)claude-3-haiku-20240307- Fastest, most economicalclaude-3-opus-20240229- Most capable, highest cost
Features:
- Advanced reasoning and analysis
- Long context windows (up to 200k tokens)
- Code understanding and generation
- Safety-focused responses
Access to GPT models including GPT-4.
Setup:
- Get API key from https://platform.openai.com/api-keys
- Configure:
export OPENAI_API_KEY="sk-your-api-key-here"
export OPENAI_MODEL="gpt-4" # or gpt-3.5-turbo
codeduetAccess to Claude models.
Setup:
- Get API key from https://console.anthropic.com
- Configure:
export ANTHROPIC_API_KEY="sk-ant-your-api-key-here"
codeduetScalable GPU inference for larger models.
Setup:
- Create account at https://runpod.io
- Deploy a serverless endpoint with an OpenAI-compatible model
- Get your endpoint URL and API key
- Configure:
export RUNPOD_API_KEY="your-runpod-api-key"
export RUNPOD_BASE_URL="https://api-xxxxxxxxx.runpod.io/v1"
export RUNPOD_MODEL="your-model-name"
codeduetCreate a .env file in your project directory:
# For Ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=codellama
# For LM Studio
LM_STUDIO_BASE_URL=http://localhost:1234
LM_STUDIO_MODEL=CodeLlama-7B-Instruct
# For OpenAI
OPENAI_API_KEY=sk-your-key-here
OPENAI_MODEL=gpt-4
# For Anthropic
ANTHROPIC_API_KEY=sk-ant-your-key-here
# For RunPod
RUNPOD_API_KEY=your-runpod-key
RUNPOD_BASE_URL=https://api-xxxxxxxxx.runpod.io/v1
RUNPOD_MODEL=llama2-7b-chatYou can configure multiple providers and switch between them:
# Setup multiple providers
export OLLAMA_MODEL="codellama"
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
# CodeDuet will prompt you to choose or use the first available
codeduet| Provider | Cost | Privacy | Speed | Model Selection |
|---|---|---|---|---|
| Ollama | Free | Complete | Fast* | Good |
| LM Studio | Free | Complete | Fast* | Good |
| OpenAI | Pay-per-use | External | Fast | Excellent |
| Anthropic | Pay-per-use | External | Fast | Good |
| RunPod | GPU-on-demand | External | Very Fast | Excellent |
*Speed depends on your hardware
- Ollama with
codellamaormistral - No costs, complete privacy, decent performance
- OpenAI GPT-4 or Anthropic Claude
- Best reasoning capabilities, latest features
- LM Studio for privacy-sensitive work
- RunPod for scalable processing
- OpenAI/Anthropic for production workflows
- Start with Ollama for most tasks
- Use OpenAI GPT-3.5 for complex reasoning
- Switch to GPT-4 only when needed
# Check if Ollama is running
ollama list
# Restart Ollama service
ollama serve
# Check connectivity
curl http://localhost:11434/api/tags- Ensure the local server is started in LM Studio
- Check the server logs in LM Studio
- Verify the model is loaded and ready
# Test connectivity
curl -X POST http://localhost:11434/api/generate \
-d '{"model":"llama2","prompt":"Hello"}'
# For LM Studio
curl -X POST http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"local-model","messages":[{"role":"user","content":"Hello"}]}'# Check current environment
env | grep -E "(OLLAMA|LM_STUDIO|OPENAI|ANTHROPIC|RUNPOD)"
# Clear and reset if needed
unset OLLAMA_BASE_URL OLLAMA_MODEL
export OLLAMA_MODEL="codellama"- Keep Ollama/LM Studio updated
- Use firewall rules to restrict access if needed
- Models are stored locally - ensure disk encryption
- Never commit API keys to version control
- Use environment variables or secure key management
- Rotate API keys regularly
- Monitor usage and set billing limits
- Use
.envfiles for project-specific configuration - Keep API keys in secure password managers
- Be mindful of data sensitivity when choosing providers
- Ollama:
codellama,deepseek-coder - OpenAI:
gpt-4,gpt-3.5-turbo - Anthropic:
claude-3-sonnet
- Ollama:
llama2,mistral,neural-chat - OpenAI:
gpt-4-turbo - Anthropic:
claude-3-opus
- Ollama:
phi3,gemma - OpenAI:
gpt-3.5-turbo
Choose models based on your hardware capabilities and performance requirements.