← 返回
开发者工具 Key 中文

Azure OpenAI Proxy

Enable Azure OpenAI integration with OpenClaw via a lightweight local proxy. Use when configuring Azure OpenAI as a model provider, when encountering 404 errors with Azure OpenAI in OpenClaw, or when needing to use Azure credits (e.g. Visual Studio subscription) with OpenClaw subagents. Solves the api-version query parameter issue that prevents direct Azure OpenAI integration.
通过轻量级本地代理为 OpenClaw 启用 Azure OpenAI 集成。适用于配置 Azure OpenAI 模型提供商、解决 OpenClaw 中 Azure OpenAI 404 错误,或在 OpenClaw 子代理中使用 Azure 额度(如 Visual Studio 订阅)。修复了导致无法直接集成 Azure OpenAI 的 api-version 查询参数问题。
benediktschackenberg benediktschackenberg 来源
开发者工具 clawhub v1.0.0 1 版本 99908.2 Key: 需要
★ 3
Stars
📥 2,116
下载
💾 31
安装
1
版本
#latest

概述

Azure OpenAI Proxy for OpenClaw

A lightweight Node.js proxy that bridges Azure OpenAI with OpenClaw.

The Problem

OpenClaw constructs API URLs like this:

const endpoint = `${baseUrl}/chat/completions`;

Azure OpenAI requires:

https://{resource}.openai.azure.com/openai/deployments/{model}/chat/completions?api-version=2025-01-01-preview

When api-version is in the baseUrl, OpenClaw's path append breaks it.

Quick Setup

1. Configure and Run the Proxy

# Set your Azure details
export AZURE_OPENAI_ENDPOINT="your-resource.openai.azure.com"
export AZURE_OPENAI_DEPLOYMENT="gpt-4o"
export AZURE_OPENAI_API_VERSION="2025-01-01-preview"

# Run the proxy
node scripts/server.js

2. Configure OpenClaw Provider

Add to ~/.openclaw/openclaw.json:

{
  "models": {
    "providers": {
      "azure-gpt4o": {
        "baseUrl": "http://127.0.0.1:18790",
        "apiKey": "YOUR_AZURE_API_KEY",
        "api": "openai-completions",
        "authHeader": false,
        "headers": {
          "api-key": "YOUR_AZURE_API_KEY"
        },
        "models": [
          { "id": "gpt-4o", "name": "GPT-4o (Azure)" }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "models": {
        "azure-gpt4o/gpt-4o": {}
      }
    }
  }
}

Important: Set authHeader: false — Azure uses api-key header, not Bearer tokens.

3. (Optional) Use for Subagents

Save Azure credits by routing automated tasks through Azure:

{
  "agents": {
    "defaults": {
      "subagents": {
        "model": "azure-gpt4o/gpt-4o"
      }
    }
  }
}

Run as systemd Service

Copy the template and configure:

mkdir -p ~/.config/systemd/user
cp scripts/azure-proxy.service ~/.config/systemd/user/

# Edit the service file with your Azure details
nano ~/.config/systemd/user/azure-proxy.service

# Enable and start
systemctl --user daemon-reload
systemctl --user enable azure-proxy
systemctl --user start azure-proxy

Environment Variables

VariableDefaultDescription
--------------------------------
AZURE_PROXY_PORT18790Local proxy port
AZURE_PROXY_BIND127.0.0.1Bind address
AZURE_OPENAI_ENDPOINTAzure resource hostname
AZURE_OPENAI_DEPLOYMENTgpt-4oDeployment name
AZURE_OPENAI_API_VERSION2025-01-01-previewAPI version

Health Check

curl http://localhost:18790/health
# {"status":"ok","deployment":"gpt-4o"}

Troubleshooting

404 Resource not found: Check endpoint hostname and deployment name match Azure Portal.

401 Unauthorized: API key is wrong or expired.

Content Filter Errors: Azure has aggressive content filtering — some prompts that work on OpenAI may get blocked.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 17:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,437
dev-programming

Docker Essentials

arnarsson
核心 Docker 命令和工作流程,包括容器管理、镜像操作和调试。
★ 38 📥 32,252
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,498