Proxy server để kết nối Cursor IDE với Azure Anthropic API (Claude).
- Base URL: https://cursor-azure-claude-proxy-production.up.railway.app/
- Health Check: https://cursor-azure-claude-proxy-production.up.railway.app/health
GET /- Thông tin về server và các endpoints có sẵn
GET /health- Kiểm tra trạng thái server
POST /chat/completions- Endpoint chính cho Cursor IDE (OpenAI format)POST /v1/chat/completions- OpenAI formatPOST /v1/messages- Anthropic native format
- Mở Cursor Settings
- Tìm phần "Model" hoặc "Model Settings" Mở "Opus 4.5"
- API Keys mucj OpenAI Custom API URL:
https://cursor-azure-claude-proxy-production.up.railway.app - Đặt API Key: Giá trị phải trùng khớp chính xác với biến môi trường
SERVICE_API_KEYtrong file.envcủa server. Bật OpenAI API key
Lưu ý quan trọng: API Key trong Cursor IDE (Cursor Settings > Models > API Keys > OpenAI API Key) phải khớp chính xác với giá trị SERVICE_API_KEY trong file .env của server. Nếu không khớp, request sẽ bị từ chối với lỗi authentication.
curl -X POST https://cursor-azure-claude-proxy-production.up.railway.app/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_SERVICE_API_KEY" \
-d '{
"model": "claude-opus-4-5",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Lưu ý: Thay YOUR_SERVICE_API_KEY bằng giá trị thực từ biến môi trường SERVICE_API_KEY.
AZURE_ENDPOINT- Foundry resource base URL, e.g.https://<resource>.services.ai.azure.com(bare host, no path). The server appends/anthropic/v1/messagesfor Claude and reuses the same host for the Azure OpenAI calls. The legacy full-URL form (.../anthropic/v1/messages) is still accepted for backward compatibility.AZURE_API_KEY- Azure API key (shared with the OpenAI endpoint on the same Foundry resource)AZURE_CLAUDE_DEPLOYMENT_NAME- Default Claude deployment name, e.g.claude-opus-4-7. Used for every Claude request unless a family-specific override is set.- (optional)
AZURE_CLAUDE_OPUS_DEPLOYMENT,AZURE_CLAUDE_SONNET_DEPLOYMENT,AZURE_CLAUDE_HAIKU_DEPLOYMENT- override the deployment per model family
Azure OpenAI uses a different host than Anthropic (cognitiveservices.azure.com instead of services.ai.azure.com), so AZURE_OPENAI_ENDPOINT is required for GPT. Leave it unset to disable the GPT route — Claude keeps working either way.
AZURE_OPENAI_ENDPOINT- Azure OpenAI endpoint. Two forms are supported:- v1 API (recommended):
https://<resource>.cognitiveservices.azure.com/openai/v1- Request URL becomes
<endpoint>/chat/completions?api-version=preview— the api-version is fixed andAZURE_OPENAI_API_VERSIONis ignored.
- Request URL becomes
- Legacy deployment URL:
https://<resource>.cognitiveservices.azure.com- Request URL becomes
<host>/openai/deployments/<deployment>/chat/completions?api-version=<AZURE_OPENAI_API_VERSION>.
- Request URL becomes
- v1 API (recommended):
AZURE_GPT_DEPLOYMENT- Exact name of the gpt-5.4 deployment in your Azure resource. Defaultgpt-5.4AZURE_OPENAI_API_VERSION- Only used with the legacy endpoint form. Default2025-04-01-preview.GPT_REASONING_EFFORT- Fallback effort (minimal/low/medium/high) when Cursor sends the baregpt-5.4id without a suffix. Defaultmedium- (optional)
AZURE_OPENAI_API_KEY- defaults toAZURE_API_KEY
SERVICE_API_KEY- Key used to authenticate Cursor against this proxy (must match Cursor's OpenAI API Key field)PORT- Server port (default 8080; Railway assigns its own)- (optional)
LOG_TOOL_CALLS,LOG_MESSAGES- verbose logging toggles (true/false)
Azure Foundry ships gpt-5.4 with native Chat Completions support since 2026-03-05, so the proxy forwards Cursor's OpenAI request almost unchanged (only swapping the model name to the deployment, stripping temperature/top_p, and converting max_tokens → max_completion_tokens, as required by reasoning models).
-
Deploy
gpt-5.4in the same Foundry resource you use for Claude. Note thatgpt-5.4andgpt-5.4-procurrently require access registration on Azure. -
Set the
AZURE_OPENAI_*env vars above on Railway and redeploy. -
In Cursor Settings → Models → Custom Models, add any of these model ids. Each one maps to the same Azure deployment, only
reasoning_effortchanges:Cursor model id reasoning_effort gpt-5.4falls back to GPT_REASONING_EFFORT(defaultmedium)gpt-5.4-minimalminimalgpt-5.4-lowlowgpt-5.4-mediummediumgpt-5.4-highhigh -
Keep the OpenAI API Key field set to your
SERVICE_API_KEYand the base URL pointing at this proxy — both Claude and GPT-5.4 share the same proxy endpoint and auth key.
curl -X POST https://cursor-azure-claude-proxy-production.up.railway.app/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SERVICE_API_KEY" \
-d '{
"model": "gpt-5.4-medium",
"messages": [{"role": "user", "content": "Say hi in one word."}]
}'npm install
npm startnpm run dev-
Tạo project mới trên Railway
- Truy cập Railway
- Tạo project mới từ GitHub repository hoặc Deploy từ GitHub
-
Cấu hình Environment Variables
- Vào tab Variables trong Railway project
- Thêm các biến môi trường sau:
# Azure Anthropic AZURE_ENDPOINT=https://<resource>.services.ai.azure.com AZURE_API_KEY=your-azure-api-key AZURE_CLAUDE_DEPLOYMENT_NAME=claude-opus-4-7 AZURE_CLAUDE_SONNET_DEPLOYMENT=claude-sonnet-4-6 AZURE_CLAUDE_HAIKU_DEPLOYMENT=claude-haiku-4-6 # Azure OpenAI (gpt-5.4) — note different host from AZURE_ENDPOINT AZURE_OPENAI_ENDPOINT=https://<resource>.cognitiveservices.azure.com/openai/v1 AZURE_GPT_DEPLOYMENT=gpt-5.4 GPT_REASONING_EFFORT=high # Only needed with the legacy (non-/openai/v1) endpoint form: # AZURE_OPENAI_API_VERSION=2025-04-01-preview # Service SERVICE_API_KEY=your-random-secret-key PORT=3000 LOG_TOOL_CALLS=false LOG_MESSAGES=false - Lưu ý:
SERVICE_API_KEYđể bảo vệ dịch vụ của bạn. Hãy đặt nó thành một chuỗi ký tự ngẫu nhiên.
-
Cấu hình Build Settings
- Railway sẽ tự động detect Node.js project
-
Deploy
- Railway sẽ tự động deploy khi bạn push code lên GitHub
- Hoặc click Deploy trong Railway dashboard
- Sau khi deploy thành công, Railway sẽ cung cấp một public URL
-
Kiểm tra Health Check
- Truy cập:
https://your-app.up.railway.app/health - Nếu trả về
{"status":"ok"}, server đã chạy thành công
- Truy cập:
-
Cấu hình Custom Domain (tùy chọn)
- Vào tab Settings > Networking
- Thêm custom domain nếu cần
- Railway tự động cung cấp
PORTqua biến môi trường, nhưng bạn vẫn có thể setPORT=8080để đảm bảo SERVICE_API_KEYphải khớp chính xác với API Key bạn cấu hình trong Cursor IDE- Kiểm tra logs trong Railway dashboard nếu gặp lỗi
MIT
Dự án này được tham khảo từ Cursor-Azure-GPT-5 - một service cho phép Cursor sử dụng Azure GPT-5 deployments.



