Skip to content

chore(provider): use pi-ai's azure-openai-responses for azure openai endpoints#50851

Merged
obviyus merged 32 commits intoopenclaw:mainfrom
kunalk16:chore-azure-openai-use-azure-openai-responses
Mar 30, 2026
Merged

chore(provider): use pi-ai's azure-openai-responses for azure openai endpoints#50851
obviyus merged 32 commits intoopenclaw:mainfrom
kunalk16:chore-azure-openai-use-azure-openai-responses

Conversation

@kunalk16
Copy link
Copy Markdown
Contributor

@kunalk16 kunalk16 commented Mar 20, 2026

Summary

Describe the problem and fix in 2–5 bullets:
This is just a small extension to this PR: #49543
We now use the "azure-openai-responses" implementation for azure openai custom provider endpoint. A manually configured azure openai endpoint with api "azure-openai-responses" fails as the enum MODEL_APIS in types.models.ts does not have an entry for "azure-openai-responses"

Response sanitization, etc not needed for azure-openai-responses as we have done for openai-responses, verified it manually

  • Problem:
  • Why it matters: pi-ai has a dedicated handler for azure-openai endpoints named "azure-openai-responses" to take care of azure-openai responses API calls, we might as well use it over "openai-responses" for azure openai endpoints as it has some specific handling over "openai-responses" which users might hit for some edge cases.
  • What changed: For custom azure openai endpoints, we were earlier using "openai-responses" we now use "azure-openai-responses"
  • What did NOT change (scope boundary): Scope is only the config generated for azure openai endpoints through custom provider onboarding.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
The generated config now has api "azure-openai-responses" rather than "openai-responses" for custom provider azure openai endpoints.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Manually verified that after the change, tui and agent with tool calls work with a configured azure openai endpoint
image

Manually verified that after the change, the api field in focus generates "azure-openai-responses"
image

Environment

  • OS: Ubuntu 25.10/Ubuntu 24.04
  • Runtime/container: Tested in both Azure VM & Docker container
  • Model/provider: Azure OpenAI gpt-5.2-chat & gpt-5.3-chat
  • Integration/channel (if any):
  • Relevant config (redacted):
{
  "wizard": {
    "lastRunAt": "2026-03-20T04:33:02.576Z",
    "lastRunVersion": "2026.3.14",
    "lastRunCommand": "onboard",
    "lastRunMode": "local"
  },
  "models": {
    "mode": "merge",
    "providers": {
      "custom-kkarmakar-ai-eus2-openai-azure-com": {
        "baseUrl": "https://resource.openai.azure.com/openai/v1",
        "apiKey": "key1234",
        "api": "azure-openai-responses",
        "headers": {
          "api-key": "key1234"
        },
        "authHeader": false,
        "models": [
          {
            "id": "gpt-5.3-chat",
            "name": "gpt-5.3-chat (Custom Provider)",
            "reasoning": true,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 400000,
            "maxTokens": 16384,
            "compat": {
              "supportsStore": false
            }
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "custom-resource-openai-azure-com/gpt-5.3-chat"
      },
      "models": {
        "custom-resource-openai-azure-com/gpt-5.3-chat": {
          "params": {
            "thinking": "medium"
          }
        }
      },
      "workspace": "/root/.openclaw/workspace"
    }
  },
  "tools": {
    "profile": "coding"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw"
  },
  "session": {
    "dmScope": "per-channel-peer"
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",
      "token": "0e8dbc50a15d49e09a70c4594b0f1a0abcbce8f6e1ebc51d"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    },
    "nodes": {
      "denyCommands": [
        "camera.snap",
        "camera.clip",
        "screen.record",
        "contacts.add",
        "calendar.add",
        "reminders.add",
        "sms.send"
      ]
    }
  },
  "meta": {
    "lastTouchedVersion": "2026.3.14",
    "lastTouchedAt": "2026-03-20T04:33:02.586Z"
  }
}

Steps

  1. Install openclaw
  2. Onboard an azure openai endpoint using custom provider option or onboard an azure openai endpoint with api "azure-openai-responses" manually

Expected

TUI/Agent should work

Actual

Currently, without the change, onboarding wizard generates a config with "openai-responses" api fo azure openai responses which works but we dont know if any use case will break as pi-ai has a dedicated "azure-openai-responses" specifically for azure openai endpoints.
A manually configured azure openai endpoint with api "azure-openai-responses" fails as the enum MODEL_APIS in types.models.ts does not have an entry for "azure-openai-responses"

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    Manually installed openclaw, did the onboarding with custom provider interactive onboarding, verified tui & agent tool calls, verified the config file generated
    Response sanitization, etc not needed for azure-openai-responses as we have done for openai-responses, verified it manually, if we add the sanitization, we get 400 errors for azure-openai-responses
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? Not applicable
  • Config/env changes? Not applicable
  • Migration needed? Not applicable
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert the PR
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

None

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: XS labels Mar 20, 2026
kunalk16 added a commit to kunalk16/openclaw that referenced this pull request Mar 20, 2026
kunalk16 added a commit to kunalk16/openclaw that referenced this pull request Mar 20, 2026
@kunalk16 kunalk16 force-pushed the chore-azure-openai-use-azure-openai-responses branch from f798500 to 436dd99 Compare March 20, 2026 05:19
@kunalk16 kunalk16 marked this pull request as ready for review March 20, 2026 05:19
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR extends the Azure OpenAI custom provider onboarding flow to use pi-ai's dedicated "azure-openai-responses" API implementation instead of the generic "openai-responses", and registers "azure-openai-responses" as a valid value in the config type enum and JSON schema so manually-configured endpoints with this API no longer fail validation.

  • src/config/types.models.ts — adds "azure-openai-responses" to the MODEL_APIS const array so the TypeScript type and runtime validation accept it.
  • src/config/schema.base.generated.ts — adds "azure-openai-responses" to both relevant api enum arrays (provider-level and model-level) in the generated JSON schema.
  • src/agents/pi-embedded-runner/model.ts — adds "azure-openai-responses" to the normalizeResolvedTransportApi switch so it is passed through as a valid transport API rather than discarded.
  • src/commands/onboard-custom.ts — changes the providerApi assignment for isAzureOpenAi from "openai-responses" to "azure-openai-responses".
  • src/commands/onboard-custom.test.ts — updates two test expectations to reflect the new API value for Azure OpenAI URLs.
  • CHANGELOG.md — adds two entries for fix(provider): tui/agent etc not working when azure openai endpoint is onboarded through custom provider #49543 and chore(provider): use pi-ai's azure-openai-responses for azure openai endpoints #50851.

The change is narrow and focused. The "azure-openai-responses" string was already present in numerous test and runtime files, confirming that pi-ai support for it already exists upstream; this PR simply wires it into the type system and onboarding path.

Confidence Score: 5/5

Safe to merge — change is small, focused, and all four touch-points (type enum, JSON schema, transport normalizer, onboarding logic) are updated consistently with matching test coverage.

No new P0/P1 issues found. All remaining observations from prior review threads (trailing comma, CHANGELOG scope wording) are already logged and tracked there. The core logic change is a single string swap that is fully consistent with the existing codebase patterns and validated by updated tests.

No files require special attention.

Important Files Changed

Filename Overview
src/config/types.models.ts Adds 'azure-openai-responses' to MODEL_APIS const array — straightforward enum extension.
src/config/schema.base.generated.ts Adds 'azure-openai-responses' to both api enum arrays in the generated JSON schema — consistent with types.models.ts change.
src/agents/pi-embedded-runner/model.ts Adds 'azure-openai-responses' case to normalizeResolvedTransportApi switch — passes it through as a valid transport API.
src/commands/onboard-custom.ts Switches providerApi for isAzureOpenAi from 'openai-responses' to 'azure-openai-responses' — core logic change.
src/commands/onboard-custom.test.ts Updates two test expectations to assert 'azure-openai-responses' for Azure OpenAI URLs — correctly mirrors the source change.
CHANGELOG.md Adds two changelog entries for #49543 and #50851; prior thread already flagged the Azure AI Foundry scope wording.

Reviews (7): Last reviewed commit: "Fix generated file" | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 436dd99c39

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

kunalk16 added a commit to kunalk16/openclaw that referenced this pull request Mar 20, 2026
@kunalk16 kunalk16 force-pushed the chore-azure-openai-use-azure-openai-responses branch from 218221b to 366efe9 Compare March 20, 2026 05:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 366efe9c1e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Mar 20, 2026
@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49ae5aaf3f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

@openclaw-barnacle openclaw-barnacle bot removed the agents Agent runtime and tooling label Mar 20, 2026
@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

1 similar comment
@kunalk16
Copy link
Copy Markdown
Contributor Author

@greptileai

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33b86851e9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eca004a911

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@obviyus obviyus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this seems incomplete. A lot of OpenClaw still only checks for api === "openai-responses" before doing the cleanup/sanitization logic. So after this PR, newly onboarded Azure models still go through Azure transport, but they stop getting the existing cleanup behavior

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7c6134694

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

kunalk16 added a commit to kunalk16/openclaw that referenced this pull request Mar 30, 2026
@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Mar 30, 2026
@obviyus obviyus force-pushed the chore-azure-openai-use-azure-openai-responses branch from 620b310 to 57cb38f Compare March 30, 2026 10:42
@obviyus obviyus merged commit 34b0a19 into openclaw:main Mar 30, 2026
9 checks passed
Copy link
Copy Markdown
Contributor

@obviyus obviyus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed latest changes; landing now.

@obviyus
Copy link
Copy Markdown
Contributor

obviyus commented Mar 30, 2026

Landed on main.

Thanks @kunalk16.

@kunalk16 kunalk16 deleted the chore-azure-openai-use-azure-openai-responses branch March 30, 2026 10:47
pgondhi987 pushed a commit to pgondhi987/openclaw that referenced this pull request Mar 31, 2026
…50851) (thanks @kunalk16)

* Add azure-openai-responses

* Unit tests update for updated API

* Add entry for PR openclaw#50851

* Add comma to address PR comment

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Update changelog stating Azure OpenAI only

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Add references

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Fix generated file

* Add azure openai responses to OPENAI_RESPONSES_APIS

* Add azure openai responses to createParallelToolCallsWrapper

* Adding azure openai responses to attempt.ts

* Add azure openai responses to google.ts

* Address PR comment on sanitization of output

* Revert commit

* Address PR comment on sanitization of output

* Revert commit

* Address PR comment on sanitization of output

* Revert commit

* Fix changelog

* Fix linting

* fix: cover azure responses wrapper path (openclaw#50851) (thanks @kunalk16)

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Ayaan Zaidi <[email protected]>
pgondhi987 pushed a commit to pgondhi987/openclaw that referenced this pull request Mar 31, 2026
…50851) (thanks @kunalk16)

* Add azure-openai-responses

* Unit tests update for updated API

* Add entry for PR openclaw#50851

* Add comma to address PR comment

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Update changelog stating Azure OpenAI only

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Add references

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Address PR comment on sanitization of output

* Address review comment

* Revert commits

* Revert commit

* Fix generated file

* Add azure openai responses to OPENAI_RESPONSES_APIS

* Add azure openai responses to createParallelToolCallsWrapper

* Adding azure openai responses to attempt.ts

* Add azure openai responses to google.ts

* Address PR comment on sanitization of output

* Revert commit

* Address PR comment on sanitization of output

* Revert commit

* Address PR comment on sanitization of output

* Revert commit

* Fix changelog

* Fix linting

* fix: cover azure responses wrapper path (openclaw#50851) (thanks @kunalk16)

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants