claude-azure
v1.1.0
Published
Claude Code with native Azure OpenAI support
Readme
╔═╗
║Q║ Claude Azure
╚═╝Claude Azure
Run Claude Code with Azure OpenAI, OpenAI, or Anthropic
Features • Quick Start • Configuration • Deployment Modes • Troubleshooting
Overview
Claude Azure is a fork of Claude Code that adds native support for Azure OpenAI and OpenAI alongside the standard Anthropic API. It provides a seamless local proxy that translates Anthropic API calls to Azure/OpenAI formats, letting you use Claude Code with your existing Azure deployments.
Features
✨ Multi-Provider Support
- Azure OpenAI (Tiered or Model Router modes)
- OpenAI API
- Anthropic API (native passthrough)
🔧 Flexible Deployment Options
- Tiered Mode: Map model sizes to separate Azure deployments
- Model Router Mode: Single endpoint with Azure APIM routing
🚀 Zero-Friction Setup
- Interactive setup wizard
- Automatic proxy configuration
- Seamless Claude Code integration
🔒 Secure Configuration
- Local config storage (
~/.claude-azure/config.json) - No cloud credentials required beyond provider API keys
Quick Start
Prerequisites
Install Claude Code (required):
curl -fsSL https://claude.ai/install.sh | bashAzure OpenAI resource (if using Azure) with deployed models
Installation
Option 1: npm (Recommended)
# Install globally from npm
npm install -g claude-azure
# Run setup wizard
claude-azureOption 2: From Source
# Clone and install
git clone https://github.com/schwarztim/claude-azure.git
cd claude-azure
npm install
npm run build
npm link
# Run setup wizard
claude-azureWindows Users: Works on PowerShell, Command Prompt, and WSL. Claude Code must be installed first.
First Run
The setup wizard will guide you through configuration:
╔═╗
║Q║ Claude Azure
╚═╝
Claude Azure Setup
─────────────────────────────────────
? Select your AI provider:
❯ Azure OpenAI - Use Azure-hosted models
OpenAI - Use OpenAI API directly
Anthropic - Use Anthropic API directlyAzure OpenAI Configuration
Azure OpenAI Configuration
Get these from Azure Portal → Azure OpenAI → Keys and Endpoint
? Azure OpenAI Endpoint: https://myresource.openai.azure.com
? Azure OpenAI API Key: ********
? API Version: 2024-12-01-preview
Deployment Mode
? Select deployment mode:
❯ Tiered - Separate deployments for different model sizes
Model Router - Single deployment for all models
# For Tiered mode:
? Opus/Large model deployment: gpt-4o
? Sonnet/Medium model deployment: gpt-4o
? Haiku/Small model deployment: gpt-4o-mini
# For Model Router mode:
? Model Router deployment name: model-router
✔ Testing Azure connection...
✓ Configuration saved!Usage
# First run - interactive setup
claude-azure
# Reconfigure provider/settings
claude-azure --setup
# Reset all configuration
claude-azure --reset
# Show proxy debug logs
claude-azure --verbose
# Pass arguments to Claude Code
claude-azure -p "explain this codebase"
claude-azure --model sonnetConfiguration
Config File Location
~/.claude-azure/config.json
Example Configuration (Tiered Mode)
{
"provider": "azure",
"azure": {
"endpoint": "https://myresource.openai.azure.com",
"apiKey": "sk-...",
"apiVersion": "2024-12-01-preview",
"deployments": {
"opus": "gpt-4o",
"sonnet": "gpt-4o",
"haiku": "gpt-4o-mini"
}
}
}Example Configuration (Model Router Mode)
{
"provider": "azure",
"azure": {
"endpoint": "https://myresource.openai.azure.com",
"apiKey": "sk-...",
"apiVersion": "2024-12-01-preview",
"modelRouter": "model-router"
}
}Deployment Modes
Tiered Mode (Traditional)
When to use:
- Fine-grained control over model deployments
- Cost optimization by model size
- Different models for different tiers
How it works:
- Separate Azure deployments for each model class
- Maps Claude model names to your deployments:
claude-opus-*→deployments.opus(e.g., gpt-4o)claude-sonnet-*→deployments.sonnet(e.g., gpt-4o)claude-haiku-*→deployments.haiku(e.g., gpt-4o-mini)
Model Router Mode (Azure APIM)
When to use:
- Azure API Management with routing logic
- Dynamic model selection
- Simplified deployment management
How it works:
- Single deployment endpoint
- Passes original Claude model name (e.g.,
claude-sonnet-4) to the router - Your APIM policy routes to appropriate backend
How It Works
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Claude Code │───▶│ Local Proxy │───▶│ Azure OpenAI │
│ │ │ (auto port) │ │ │
│ ANTHROPIC_BASE │ │ Translates: │ │ /chat/complete │
│ _URL=localhost │ │ Anthropic→ │ │ │
│ │ │ OpenAI │ │ │
└─────────────────┘ └──────────────┘ └─────────────────┘Key Components:
- Claude Code - The official Anthropic CLI tool
- Local Proxy - Translates API formats in real-time
- Azure/OpenAI - Your cloud AI provider
For Anthropic provider, no proxy is used (direct passthrough).
Keeping Up to Date
Stay in sync with upstream Claude Code:
cd ~/Scripts/claude-azure
git fetch upstream
git merge upstream/main
npm install
npm run buildTroubleshooting
| Issue | Solution |
|-------|----------|
| claude-azure: command not found | Run npm link from project directory |
| Claude Code not found | Install from https://claude.ai/code |
| Connection errors | Verify endpoint/key in ~/.claude-azure/config.json |
| Tool calls failing | Run with --verbose to see proxy request/response logs |
| Model not found | Check deployment names match your Azure resource |
| Rate limiting | Azure quotas apply - check Azure Portal metrics |
Verbose Logging
claude-azure --verboseShows:
- Proxy startup details
- Request/response translation
- Azure API calls
- Error details
Development
# Clone and install
git clone https://github.com/schwarztim/claude-azure.git
cd claude-azure
npm install
# Watch mode
npm run dev
# Build
npm run build
# Test locally
npm link
claude-azure --setupArchitecture
src/
├── cli.ts # Main entry point, setup wizard
├── config.ts # Configuration management
├── proxy.ts # API translation proxy
└── index.ts # Exports
dist/ # Compiled JavaScript
~/.claude-azure/ # User configuration
└── config.jsonContributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
Related Projects
- Claude Code - The official Anthropic CLI tool
- Azure OpenAI - Microsoft's Azure OpenAI service
License
MIT License - See LICENSE for details
Azure wrapper code is MIT licensed. Original Claude Code license applies to upstream code.
Acknowledgments
- Built on top of Claude Code by Anthropic
- Inspired by the need for Azure OpenAI enterprise deployment support
Made with ❤️ for Azure OpenAI users
