Proxy server that converts Anthropic API requests to OpenAI format for use with OpenRouter. Enables operations teams to use Claude Code with OpenRouter instead of the Anthropic API. Connects Anthropic's API format to OpenAI-compatible endpoints.
git clone https://github.com/maxnowack/anthropic-proxy.gitProxy server that converts Anthropic API requests to OpenAI format for use with OpenRouter. Enables operations teams to use Claude Code with OpenRouter instead of the Anthropic API. Connects Anthropic's API format to OpenAI-compatible endpoints.
[{"step":"Install the proxy using the provided Docker image or Helm chart. Run `docker pull ghcr.io/your-org/anthropic-proxy:latest` and configure environment variables for OPENROUTER_API_KEY and ANTHROPIC_API_KEY.","tip":"Use Docker Compose for local testing with volumes mapped to your config directory. Set `DEBUG=true` for verbose logging during setup."},{"step":"Configure your application to point to the proxy endpoint instead of Anthropic's API. Replace `api.anthropic.com` with `localhost:8080` (or your proxy URL) in your Claude Code client initialization.","tip":"Test with `curl -X POST http://localhost:8080/v1/messages -H 'Content-Type: application/json' -d '{\"model\":\"claude-3-opus\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}'` to verify the proxy is responding."},{"step":"Validate the proxy conversion by comparing Anthropic's raw response with the OpenRouter output. Use the example output format to ensure metadata like token counts are preserved.","tip":"Automate validation with a GitHub Actions workflow that runs `anthropic-proxy-test` after each deployment to catch format regressions."},{"step":"Deploy to production with load balancing. Configure the proxy with horizontal scaling (e.g., Kubernetes HPA) to handle traffic spikes during peak usage.","tip":"Monitor the `/health` endpoint and set up alerts for proxy response times exceeding 500ms."}]
Integrate Claude Code into existing applications that rely on Anthropic API without significant rewrites.
Automate the transformation of API requests to streamline workflows between Anthropic and OpenAI services.
Use the proxy server to test and develop applications that require OpenAI-compatible endpoints while using Anthropic's API format.
Enable debugging and logging of API requests to troubleshoot issues in real-time during development.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/maxnowack/anthropic-proxyCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Set up an Anthropic-to-OpenAI proxy for [OPENROUTER_ENDPOINT] to enable Claude Code usage. Configure the proxy to handle [API_VERSION] requests and ensure compatibility with [ANTHROPIC_MODEL_NAME]. Test the proxy with a sample prompt: '[SAMPLE_PROMPT]' and verify the response format matches OpenAI's structure. Document the proxy configuration in [CONFIG_FILE_PATH].
```json
{
"id": "cmpl-proxy-12345",
"object": "chat.completion",
"created": 1712345678,
"model": "claude-3-opus-openrouter",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I've successfully configured the Anthropic-to-OpenAI proxy for OpenRouter. The proxy now accepts requests in Anthropic's format and converts them to OpenAI-compatible responses. The sample prompt 'Explain quantum computing in simple terms' was processed correctly, returning a structured response with the expected metadata. Configuration file saved to /etc/anthropic-proxy/config.json with endpoint settings for claude-3-opus-openrouter."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 89,
"total_tokens": 114
}
}
```
**Proxy Configuration Summary:**
- **Source Model:** claude-3-opus-20240229
- **Target Endpoint:** https://openrouter.ai/api/v1
- **Conversion Rules Applied:**
- Anthropic's `messages` array → OpenAI's `messages` array
- `system` parameter → `messages[0].content` with role 'system'
- `max_tokens` → `max_completion_tokens`
- **Validation Results:**
- ✅ API request/response format conversion successful
- ✅ Token usage metrics preserved
- ✅ Error handling for unsupported Anthropic parameters implemented
**Next Steps:**
1. Deploy the proxy to your Kubernetes cluster using the provided Helm chart.
2. Update your CI/CD pipeline to route Claude Code requests through this proxy.
3. Monitor performance with Prometheus metrics exposed at `/metrics`.AI for humanity, built with safety first
The Unified Interface For LLMs
We create engaging workshops for companies and private events centred around plants, flowers and all things botanical.
Advanced foundation models via API and ChatGPT
AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan