Content is user-generated and unverified.

Azure Anthropic Proxy for Cursor

Use Claude Opus 4.5 (via Azure) in Cursor IDE.

The Problem

Cursor doesn't properly pass the model field when connecting to Azure's Anthropic endpoint, resulting in:

{"error":{"type":"client","reason":"invalid_input","message":"model is required","retryable":false}}

The Solution

This proxy sits between Cursor and Azure, properly formatting requests:

Cursor → localhost:4000 → LiteLLM Proxy → Azure Anthropic API

Quick Start

1. Run Setup

bash
chmod +x setup.sh
./setup.sh

You'll be prompted for:

  • Azure Endpoint URL — e.g., https://your-resource.services.ai.azure.com/anthropic
  • Deployment Name — e.g., claude-opus-4-5
  • API Key — Your Azure API key

2. Start the Proxy

bash
./start.sh

Keep this terminal open while using Cursor.

3. Configure Cursor

  1. Open CursorSettings (Cmd + ,)
  2. Search for "openai"
  3. Set these values:
SettingValue
Override OpenAI Base URLhttp://localhost:4000/v1
OpenAI API Keysk-1234
  1. Restart Cursor (Cmd + Q, then reopen)
  2. Select model: claude-opus-4-5

4. Test It

In a new terminal:

bash
./test.sh

You should see a successful response from Claude.


Commands

CommandDescription
./start.shStart the proxy (foreground)
./stop.shStop the proxy
./test.shTest if proxy is working

Files Created

After running setup.sh:

azure-cursor-proxy/
├── setup.sh        # Initial setup script
├── start.sh        # Start the proxy
├── stop.sh         # Stop the proxy
├── test.sh         # Test connection
├── config.yaml     # LiteLLM configuration
├── .env            # Your API key (chmod 600)
├── venv/           # Python virtual environment
└── README.md       # This file

Troubleshooting

"Connection refused"

The proxy isn't running. Start it:

bash
./start.sh

Still getting "model is required"

Cursor is bypassing the proxy. Verify your settings:

  1. Base URL must be http://localhost:4000/v1 (not your Azure URL)
  2. Restart Cursor after changing settings (Cmd + Q)
  3. Make sure proxy is running (check terminal)

"Authentication Error" or "401"

Your API key is incorrect or expired. Update it:

bash
echo "AZURE_API_KEY=your-new-key-here" > .env
./stop.sh
./start.sh

"Python not found" or version issues

The setup requires Python 3.10-3.12. Install via Homebrew:

bash
brew install python@3.12

Then re-run ./setup.sh

Test the proxy directly

bash
curl http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{"model":"claude-opus-4-5","messages":[{"role":"user","content":"Hello"}],"max_tokens":20}'

Changing Configuration

Update API Key

bash
echo "AZURE_API_KEY=your-new-key" > .env
./stop.sh && ./start.sh

Change Azure Endpoint or Deployment

Edit config.yaml and update api_base and model fields, then restart:

bash
./stop.sh && ./start.sh

Use a Different Port

Edit start.sh and change --port 4000 to your preferred port. Update Cursor's Base URL accordingly.


Running in Background

To run the proxy in the background:

bash
nohup ./start.sh > proxy.log 2>&1 &

View logs:

bash
tail -f proxy.log

Stop:

bash
./stop.sh

How It Works

  1. LiteLLM is an open-source proxy that translates between different LLM APIs
  2. When Cursor sends a request to localhost:4000, LiteLLM:
    • Receives the OpenAI-formatted request
    • Adds the required model field for Azure
    • Forwards to Azure's Anthropic endpoint
    • Returns the response to Cursor
  3. The config.yaml maps model names like claude-opus-4-5 to your Azure deployment

Security Notes

  • .env file has restricted permissions (chmod 600)
  • API key never leaves your machine
  • Proxy runs locally only (localhost)
  • Don't commit .env to version control

Requirements

  • macOS (tested) or Linux
  • Python 3.10, 3.11, or 3.12 (auto-installed via Homebrew if needed)
  • Cursor IDE
  • Azure account with Anthropic models enabled
Content is user-generated and unverified.
    Use Claude Opus 4.5 in Cursor IDE via Azure Proxy | Claude