Skip to content

feat: add support for azure-ai driver#12565

Merged
Revolyssup merged 4 commits into
apache:masterfrom
Revolyssup:revolyssup/azure-openai-driver
Aug 29, 2025
Merged

feat: add support for azure-ai driver#12565
Revolyssup merged 4 commits into
apache:masterfrom
Revolyssup:revolyssup/azure-openai-driver

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Aug 29, 2025

Copy link
Copy Markdown
Contributor
❯ curl http://127.0.0.1:9080/v1/chat/completions  -XPOST -H "Content-Type: application/json"  -d '{
      "messages": [
          { "role": "system", "content": "You are a mathematician" },
          { "role": "user", "a": 1, "content": "Correct the spelling in lostu" }
      ], "stream": false
  }' | jq
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100  1442    0  1231  100   211    212     36  0:00:05  0:00:05 --:--:--   324
{
"choices": [
  {
    "content_filter_results": {
      "hate": {
        "filtered": false,
        "severity": "safe"
      },
      "protected_material_code": {
        "filtered": false,
        "detected": false
      },
      "protected_material_text": {
        "filtered": false,
        "detected": false
      },
      "self_harm": {
        "filtered": false,
        "severity": "safe"
      },
      "sexual": {
        "filtered": false,
        "severity": "safe"
      },
      "violence": {
        "filtered": false,
        "severity": "safe"
      }
    },
    "finish_reason": "stop",
    "index": 0,
    "logprobs": null,
    "message": {
      "content": "It looks like you meant to write \"lost.\"",
      "refusal": null,
      "role": "assistant"
    }
  }
],
"created": 1745912572,
"id": "chatcmpl-BRZu83059FcmuuMYD8mqdDk9kJ4Yv",
"model": "gpt-4o-2024-05-13",
"object": "chat.completion",
"prompt_filter_results": [
  {
    "prompt_index": 0,
    "content_filter_results": {
      "hate": {
        "filtered": false,
        "severity": "safe"
      },
      "jailbreak": {
        "filtered": false,
        "detected": false
      },
      "self_harm": {
        "filtered": false,
        "severity": "safe"
      },
      "sexual": {
        "filtered": false,
        "severity": "safe"
      },
      "violence": {
        "filtered": false,
        "severity": "safe"
      }
    }
  }
],
"system_fingerprint": "fp_ee1d74bde0",
"usage": {
  "completion_tokens": 11,
  "completion_tokens_details": {
    "accepted_prediction_tokens": 0,
    "audio_tokens": 0,
    "reasoning_tokens": 0,
    "rejected_prediction_tokens": 0
  },
  "prompt_tokens": 22,
  "prompt_tokens_details": {
    "audio_tokens": 0,
    "cached_tokens": 0
  },
  "total_tokens": 33
}
}
❯ echo $body
{
      "id": "ai-proxy-multi-route",
      "uri": "/v1/chat/completions",
      "methods": ["POST"],
      "plugins": {
              "ai-proxy-multi": {
                      "instances": [
                              {
                                      "name": "azure-openai",
                                      "provider": "azure-openai",
                                      "weight": 100,
                                      "auth": {
                                              "header": {
                                                      "Authorization": "Bearer 9m7VYroxITMDqOk0y1DEDEqKKEnpOknn1rV7QNQT7DrIBApcwMLYJQQJ99ALACYeBjFXJ3w3AAABACOGXGcd"
                                              }
                                      },
                                      "options": {
                                                      "model": "gpt-4o",
                                                      "max_tokens": 512,
                                                      "temperature": 1.0, "stream": false
                                      }, "override": {"endpoint":"https://ai-plugin-developer.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview"}

                              }
                      ],
                      "logging": {
                              "summaries": true,
                              "payloads": true
                      }
              },
              "file-logger": {
                      "path": "logs/file2.log"
              }
      }
}

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 29, 2025
nic-6443
nic-6443 previously approved these changes Aug 29, 2025
AlinsRan
AlinsRan previously approved these changes Aug 29, 2025
Comment thread docs/en/latest/plugins/ai-request-rewrite.md Outdated
Comment thread docs/en/latest/plugins/ai-proxy.md Outdated
@Revolyssup
Revolyssup dismissed stale reviews from AlinsRan and nic-6443 via 36c1d39 August 29, 2025 10:20
@Revolyssup
Revolyssup merged commit d29878b into apache:master Aug 29, 2025
23 of 25 checks passed
@Revolyssup
Revolyssup deleted the revolyssup/azure-openai-driver branch August 29, 2025 10:24
jizhuozhi pushed a commit to jizhuozhi/apisix that referenced this pull request Oct 18, 2025
@SkyeYoung SkyeYoung mentioned this pull request Jan 22, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants