Ollama-Claude Proxy
psenger/ollama-claude-proxy
Use Claude em qualquer ferramenta compatível com Ollama
Ver no GitHubProxy que conecta a API do Ollama com Claude da Anthropic, permitindo usar modelos Claude em ferramentas e IDEs que suportam Ollama sem modificações de código. Implementa endpoints Ollama compatíveis e mapeia automaticamente modelos Claude, com suporte a Docker e configuração por variáveis de ambiente.
Instalação
npx convez-ai psenger/ollama-claude-proxy1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Integrar Claude em IDEs e editores que suportam Ollama
- Adicionar modelos Claude em assistentes de codificação existentes
- Criar fluxos de desenvolvimento que usam Claude sem mudar infraestrutura
Veredito

Ferramenta prática para quem precisa rodar Claude em ambientes Ollama. Bem documentada e fácil de deploy, resolve um problema real de compatibilidade entre ecosistemas.
README
A tradução para o português deste README ainda está na fila.
Ollama to Claude API Proxy
A Python application that serves as a proxy between Ollama API interface and Anthropic's Claude API. This enables IDE plugins and tools that support Ollama to work seamlessly with Claude models.
Author
Philip Senger - psenger
- Linkedin: philipsenger
Features
- Full Ollama API Compatibility: Implements the essential Ollama endpoints
- Claude 4 Model Support: Access to the latest Claude 4 models through familiar Ollama interface
- Easy Model Mapping: Simple configuration for mapping Ollama model names to Claude models
- Environment-based Configuration: Simple setup using environment variables
- Comprehensive Logging: Detailed logging for debugging and monitoring
Supported Endpoints
GET /- Health check endpointGET /api/tags- Lists available modelsPOST /api/chat- Chat completionsPOST /api/show- Model details
Model Mappings
The following Ollama model names are mapped to Claude 4 models:
| Ollama Model Name | Claude Model |
|---|---|
claude-4-sonnet | claude-4-sonnet-20250514 |
claude-4-sonnet:latest | claude-4-sonnet-20250514 |
claude-4-opus | claude-4-opus-20250514 |
claude-4-opus:latest | claude-4-opus-20250514 |
claude-sonnet | claude-4-sonnet-20250514 |
claude-opus | claude-4-opus-20250514 |
Installation
Prerequisites
- Python 3.9 or higher
- Anthropic API key
Setup Steps
-
Clone or download the project files:
# Create project directory mkdir ollama-claude-proxy cd ollama-claude-proxy # Copy the main.py and requirements.txt files to this directory -
Create and activate a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies:
pip install -r requirements.txt -
Set environment variables:
# Required: Your Anthropic API key export ANTHROPIC_API_KEY="your-anthropic-api-key-here" # Optional: Custom port (default is 11434) export FLASK_PORT=11434On Windows (Command Prompt):
set ANTHROPIC_API_KEY=your-anthropic-api-key-here set FLASK_PORT=11434On Windows (PowerShell):
$env:ANTHROPIC_API_KEY="your-anthropic-api-key-here" $env:FLASK_PORT="11434" -
Run the application:
python main.py
The server will start and display:
Starting Ollama-to-Claude proxy server on port 11434
Available models: ['claude-4-sonnet', 'claude-4-sonnet:latest', 'claude-4-opus', 'claude-4-opus:latest', 'claude-sonnet', 'claude-opus']
Configuration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
ANTHROPIC_API_KEY | ✅ Yes | - | Your Anthropic API key |
FLASK_PORT | ❌ No | 11434 | Port number for the server |
Getting an Anthropic API Key
- Sign up at https://console.anthropic.com/
- Navigate to the API Keys section
- Create a new API key
- Copy the key and set it as the
ANTHROPIC_API_KEYenvironment variable
Usage
With IDE Plugins
Configure your IDE's Ollama plugin to use the proxy URL:
http://localhost:11434
Popular IDE plugins that work with this proxy:
- JetBrains IDEs: Ollama plugin
- VS Code: Various Ollama extensions
- Neovim: Ollama.nvim
Direct API Usage
You can also interact with the proxy directly using HTTP requests:
List Models
curl http://localhost:11434/api/tags
Chat Completion
curl -X POST http://localhost:11434/api/chat \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
],
"options": {
"temperature": 0.7
}
}'
Model Details
curl -X POST http://localhost:11434/api/show \
-H "Content-Type: application/json" \
-d '{"name": "claude-sonnet"}'
API Request/Response Examples
Chat Completion Request
{
"model": "claude-sonnet",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Explain quantum computing in simple terms."
}
],
"options": {
"temperature": 0.7,
"top_p": 0.9,
"max_tokens": 1000
}
}
Chat Completion Response
{
"model": "claude-sonnet",
"created_at": "2024-06-06T10:30:00Z",
"message": {
"role": "assistant",
"content": "Quantum computing is a revolutionary approach to computation..."
},
"done": true,
"total_duration": 0,
"load_duration": 0,
"prompt_eval_count": 25,
"eval_count": 150,
"eval_duration": 0
}
Troubleshooting
Common Issues
-
API Key Not Set:
ValueError: ANTHROPIC_API_KEY environment variable is requiredSolution: Set the
ANTHROPIC_API_KEYenvironment variable. -
Port Already in Use:
OSError: [Errno 48] Address already in useSolution: Either stop the service using port 11434 or set a different port using
FLASK_PORT. -
Claude API Errors:
Claude API error: 401 UnauthorizedSolution: Verify your API key is correct and has sufficient credits.
-
Model Not Found:
Model not found in mappingSolution: Use one of the supported model names listed in the mapping table.
Logging
The application provides detailed logging. Check the console output for:
- Server startup information
- Request/response details
- Error messages with stack traces
Testing the Installation
After starting the server, test it with:
# Test health check
curl http://localhost:11434/
# Test model listing
curl http://localhost:11434/api/tags
# Test simple chat
curl -X POST http://localhost:11434/api/chat \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet", "messages": [{"role": "user", "content": "Hello"}]}'
Development
Project Structure
ollama-claude-proxy/
├── CONTRIBUTING.md # How to contribute
├── Dockerfile # Docker
├── LICENSE # Liscense
├── README.md # This file
├── proxy.py # Main application file
├── requirements.txt # Python dependencies
└── venv/ # Virtual environment (created during setup)
Adding New Models
To add support for new Claude models, update the OLLAMA_TO_CLAUDE_MAPPING dictionary in main.py:
OLLAMA_TO_CLAUDE_MAPPING = {
# Existing mappings...
'new-model-name': 'claude-actual-model-id',
}
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to Anthropic for their Claude API
- Thanks to the Ollama team for their API design
- All the contributors who have helped improve this project