Skip to content

feat(gateway): add missing OpenAI-compatible endpoints (models and embeddings) - #53992

Merged
vincentkoc merged 8 commits into
mainfrom
vincentkoc-code/openapi-channel-investigation
Mar 24, 2026
Merged

vincentkoc merged 8 commits into
mainfrom
vincentkoc-code/openapi-channel-investigation

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Problem: OpenAI-compatible gateway support covered /v1/chat/completions and /v1/responses, but many clients also expect /v1/models and many RAG setups expect /v1/embeddings.
  • Why it matters: This is the highest-leverage compatibility set for Open WebUI, LobeChat, LibreChat, and embedding-driven integrations.
  • What changed: add GET /v1/models, GET /v1/models/{id}, and POST /v1/embeddings; forward explicit model overrides through chat/responses; support x-openclaw-message-channel on responses; document the full compatibility surface.
  • What did NOT change (scope boundary): no new standalone openapi channel plugin, no separate config toggles for models/embeddings, no audio/images/realtime compatibility work.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • 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

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause / Regression History (if applicable)

N/A

  • Root cause:
  • Missing detection / guardrail:
  • Prior context (git blame, prior PR, issue, or refactor if known):
  • Why this regressed now:
  • If unknown, what was ruled out:

Regression Test Plan (if applicable)

N/A

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

  • Gateway now exposes OpenAI-compatible GET /v1/models, GET /v1/models/{id}, and POST /v1/embeddings whenever the existing compatibility surface is enabled.
  • OpenAI-compatible model values now flow through as real model overrides for /v1/chat/completions and /v1/responses, unless they are openclaw:<agent> or agent:<agent> routing aliases.
  • /v1/responses now honors x-openclaw-message-channel, matching chat completions.
  • Docs now position models + embeddings + chat + responses as the highest-leverage compatibility set.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) Yes
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: adds new authenticated gateway API endpoints on the existing bearer-authenticated compatibility surface; endpoints reuse existing gateway auth helpers and agent/model filtering.

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 24.13.0
  • Model/provider: gateway compatibility surface
  • Integration/channel (if any): N/A
  • Relevant config (redacted): existing gateway HTTP compatibility config

Steps

  1. Enable the existing gateway compatibility surface.
  2. Call GET /v1/models or POST /v1/embeddings with the gateway bearer token.
  3. Call /v1/chat/completions or /v1/responses with a concrete provider/model id and verify the override is forwarded.

Expected

  • Models list returns OpenAI-style model objects.
  • Embeddings endpoint returns OpenAI-style embedding payloads.
  • Chat/responses pass through explicit model overrides.
  • Responses honors x-openclaw-message-channel.

Actual

  • Verified with targeted gateway tests and docs updates.

Evidence

Attach at least one:

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

Human Verification (required)

  • Verified scenarios: pnpm tsgo; pnpm test -- src/gateway/openai-http.test.ts src/gateway/openresponses-http.test.ts src/gateway/models-http.test.ts src/gateway/embeddings-http.test.ts.
  • Edge cases checked: canonical provider/model ids, agent-scoped model filtering, base64 embedding encoding, responses message-channel header support, model alias vs model override handling.
  • What you did not verify: full pnpm test; live client integration against Open WebUI/LobeChat/LibreChat.

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.

@vincentkoc vincentkoc self-assigned this Mar 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Mar 24, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review March 24, 2026 21:54
@aisle-research-bot

aisle-research-bot Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 5 potential security issue(s) in this PR:

# Severity Title
1 🟠 High Allowlist bypass for OpenAI/OpenResponses model enables switching to CLI providers (potential local command execution)
2 🟡 Medium Client-controlled x-openclaw-message-channel allows spoofing channel context in OpenResponses HTTP endpoint
3 🔵 Low Unhandled exception in models route URL parsing due to unsanitized Host header
4 🔵 Low Embedding model allowlist bypass on /v1/embeddings (agent-scoped policy not enforced)
5 🔵 Low Unintended enablement of /v1/models and /v1/embeddings when enabling only one API family
Vulnerabilities

1. 🟠 Allowlist bypass for OpenAI/OpenResponses model enables switching to CLI providers (potential local command execution)

Property Value
Severity High
CWE CWE-863
Location src/gateway/http-utils.ts:86-105

Description

resolveOpenAiCompatModelOverride() allows OpenAI-compat callers to set an arbitrary model string. The allowlist enforcement is skipped when the parsed provider is considered a "CLI provider" (isCliProvider(...)).

This creates a privilege escalation relative to the configured model allowlist:

  • Input: HTTP request body model (OpenAI /v1/chat/completions and OpenResponses endpoints)
  • AuthZ check: buildAllowedModelSet(...) is consulted only if the provider is not a CLI provider
  • Sink: the raw model override flows into agentCommandFromIngress with allowModelOverride: true and can select the runCliAgent(...) execution path for CLI providers

If any configured CLI backend runs local binaries (common for backends like claude-cli, codex-cli, or configured cliBackends), then an authenticated remote caller can switch the agent execution to that local backend regardless of the model allowlist, potentially triggering unintended local execution and access to local resources under the gateway's OS account.

Vulnerable logic:

if (
  !isCliProvider(parsed.provider, cfg) &&
  !allowed.allowAny &&
  !allowed.allowedKeys.has(normalized)
) {
  return { errorMessage: `Model '${normalized}' is not allowed...` };
}

return { modelOverride: raw };

Recommendation

Treat CLI providers the same as other providers for allowlist purposes, or introduce an explicit configuration gate for allowing CLI provider overrides via HTTP.

Minimum safer change: enforce the allowlist regardless of provider type:

const normalized = modelKey(parsed.provider, parsed.model);
if (!allowed.allowAny && !allowed.allowedKeys.has(normalized)) {
  return { errorMessage: `Model '${normalized}' is not allowed for agent '${params.agentId}'.` };
}

If you intentionally want to allow CLI provider use via HTTP, add a dedicated config flag (e.g. gateway.allowCliModelOverride) defaulting to false, and require it before accepting any CLI provider override. Also consider setting allowModelOverride: false by default for network-facing endpoints and only enabling it for specific trusted deployments.


2. 🟡 Client-controlled x-openclaw-message-channel allows spoofing channel context in OpenResponses HTTP endpoint

Property Value
Severity Medium
CWE CWE-290
Location src/gateway/openresponses-http.ts:626-633

Description

POST /v1/responses (OpenResponses-compatible) now enables x-openclaw-message-channel via useMessageChannelHeader: true, allowing external callers to set messageChannel for the run context.

Why this is security-relevant:

  • Input: attacker-controlled HTTP header x-openclaw-message-channel
  • Propagation: resolveGatewayRequestContext() normalizes the header but does not enforce membership in a safe/allowed set; unknown values are accepted.
  • Sink / effect: resulting messageChannel is passed into the agent run (runResponsesAgentCommand → agent command ingress), and is used broadly as channel context (e.g., tool/plugin context via agentChannel, and potentially channel-aware prompts/policies).

If any prompt templates, tool policies, plugin tool availability, moderation rules, or other enforcement decisions vary by messageChannel, a caller can spoof a more privileged/less restricted channel and bypass intended controls.

Vulnerable code (changed behavior):

const resolved = resolveGatewayRequestContext({
  req,
  model,
  user,
  sessionPrefix: "openresponses",
  defaultMessageChannel: "webchat",
  useMessageChannelHeader: true,
});

And the header is accepted as:

normalizeMessageChannel(getHeader(req, "x-openclaw-message-channel")) ?? default

Recommendation

Treat x-openclaw-message-channel as a trusted ingress hint, not a public client parameter.

Recommended fixes (pick one):

  1. Disable the header for OpenResponses (restore previous behavior):
const resolved = resolveGatewayRequestContext({
  ...,
  useMessageChannelHeader: false,
});
  1. Allowlist known-safe channels for this HTTP surface (reject or ignore unknowns):
import { resolveGatewayMessageChannel } from "../utils/message-channel.js";

const headerChannel = resolveGatewayMessageChannel(getHeader(req, "x-openclaw-message-channel"));
const messageChannel = headerChannel ?? "webchat";
  1. Gate the header behind stronger authentication / internal-only usage, e.g. only honor it for trusted-proxy mode or an internal network allowlist.

Also consider documenting clearly which HTTP endpoints honor this header and what security implications it has.


3. 🔵 Unhandled exception in models route URL parsing due to unsanitized Host header

Property Value
Severity Low
CWE CWE-20
Location src/gateway/models-http.ts:72-74

Description

resolveRequestPath() constructs a WHATWG URL using the request's Host header as the base. Because req.headers.host is user-controlled, a malformed value can cause new URL() to throw a TypeError.

  • Input: req.headers.host from the HTTP request
  • Fault point: new URL(req.url, http://${req.headers.host})
  • Impact: Triggers the top-level request handler's catch and returns 500 Internal Server Error for this route. An unauthenticated client can repeatedly send malformed Host headers to cause per-request failures (request-level DoS) on /v1/models* handling.

Vulnerable code:

function resolveRequestPath(req: IncomingMessage): string {
  return new URL(req.url ?? "/", `http://${req.headers.host || "localhost"}`).pathname;
}

Recommendation

Avoid using a user-controlled Host header as the base URL, or defensively catch URL parsing errors.

Safer options:

  1. Use a constant base (preferred, since only .pathname is needed):
function resolveRequestPath(req: IncomingMessage): string {
  try {
    return new URL(req.url ?? "/", "http://localhost").pathname;
  } catch {
    return "/";
  }
}
  1. If you must respect host, validate/normalize it and catch exceptions:
function resolveRequestPath(req: IncomingMessage): string {
  const host = typeof req.headers.host === "string" ? req.headers.host : "localhost";
  try {
    return new URL(req.url ?? "/", `http://${host}`).pathname;
  } catch {
    return new URL(req.url ?? "/", "http://localhost").pathname;
  }
}

This prevents malformed Host values from causing an exception-based failure path.


4. 🔵 Embedding model allowlist bypass on /v1/embeddings (agent-scoped policy not enforced)

Property Value
Severity Low
CWE CWE-284
Location src/gateway/embeddings-http.ts:142-208

Description

The OpenAI-compatible embeddings endpoint allows a caller to select any embedding model name under the agent’s configured embedding provider, without checking the agent’s configured/allowed model set.

  • Input: untrusted model from the HTTP request body (payload.model)
  • Policy gap: only the provider is constrained via resolveEmbeddingsTarget(...); the model id is not validated against an allowlist nor forced to the configured memorySearch.model.
  • Sink: createEmbeddingProvider({ provider: target.provider, model: target.model, ... }) will attempt to use the requested model.

Impact:

  • If operators assume agents.defaults.models (or similar model allowlists) constrain all OpenAI-compatible endpoints, a caller can request non-approved embedding models (same provider), potentially causing unexpected billing, using non-approved models, or mixing vector spaces.

Vulnerable code:

const requestModel = typeof payload.model === "string" ? payload.model.trim() : "";
...
const target = resolveEmbeddingsTarget({ requestModel, configuredProvider });
...
const options: EmbeddingProviderOptions = {
  provider: target.provider,
  model: target.model,
  ...
};

Recommendation

Enforce an agent-scoped embedding model policy for /v1/embeddings.

Options (pick one, but be explicit):

  1. Fail-closed to the configured embedding model (recommended for memory-search consistency): ignore request model except possibly for provider prefix validation.
​// Resolve provider from request only to allow/deny explicit prefixes.
const target = resolveEmbeddingsTarget({ requestModel, configuredProvider });
if ("errorMessage" in target) return ...;

​// Force model to agent config.
const configuredModel = memorySearch?.model ?? "text-embedding-3-small";
const options: EmbeddingProviderOptions = {
  ...,
  provider: target.provider,
  model: configuredModel,
};
  1. Allow overrides but enforce an allowlist: reuse the same allowlist machinery used by chat/responses (e.g., buildAllowedModelSet(...) / catalog filtering) or add a dedicated agents.*.memorySearch.allowedModels list and validate target.model (plus provider) against it.

Either way, ensure the decision is agent-scoped (based on x-openclaw-agent-id) and returns 400 with an invalid_request_error when disallowed.


5. 🔵 Unintended enablement of /v1/models and /v1/embeddings when enabling only one API family

Property Value
Severity Low
CWE CWE-276
Location src/gateway/server-http.ts:777-840

Description

/v1/models and /v1/embeddings are gated by a derived flag openAiCompatEnabled that becomes true when either openAiChatCompletionsEnabled or openResponsesEnabled is enabled.

This can expand the exposed HTTP attack surface in deployments where an operator intended to enable only /v1/responses (OpenResponses) but not OpenAI-compat endpoints like model enumeration and embeddings.

  • Trigger: enabling openResponsesEnabled (or chat completions)
  • Effect: additional endpoints are served (/v1/models, /v1/embeddings) without an independent enablement decision
  • Impact: increased surface area; potential information disclosure (model catalog details) and unexpected availability of embeddings functionality to any client that already has gateway auth

Vulnerable logic:

const openAiCompatEnabled = openAiChatCompletionsEnabled || openResponsesEnabled;
...
openAiCompatEnabled ? handleOpenAiModelsHttpRequest(...) : false
openAiCompatEnabled ? handleOpenAiEmbeddingsHttpRequest(...) : false

Recommendation

Introduce independent feature flags (and config entries) for /v1/models and /v1/embeddings, defaulting to disabled, and only enable them when explicitly configured.

Example approach:

const modelsEnabled = opts.openAiModelsEnabled === true;
const embeddingsEnabled = opts.openAiEmbeddingsEnabled === true;

...
run: () => (modelsEnabled ? handleOpenAiModelsHttpRequest(req, res, commonOpts) : false),
run: () => (embeddingsEnabled ? handleOpenAiEmbeddingsHttpRequest(req, res, commonOpts) : false),

If the intent is "OpenAI compatibility mode" across both OpenResponses + ChatCompletions, make that explicit as a single config flag (e.g. gateway.http.openAiCompat.enabled) and document that it also enables /v1/models and /v1/embeddings.


Analyzed PR: #53992 at commit dac07d0

Last updated on: 2026-03-24T22:51:48Z

@vincentkoc vincentkoc changed the title feat(gateway): add OpenAI-compatible models and embeddings endpoints feat(gateway): add missing OpenAI-compatible endpoints (models and embeddings) Mar 24, 2026

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

Copy link
Copy Markdown
Contributor

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: 2cce8e5d19

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/embeddings-http.ts Resolved
Comment thread src/gateway/embeddings-http.ts Resolved
@greptile-apps

greptile-apps Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends the gateway's OpenAI-compatible surface with GET /v1/models, GET /v1/models/{id}, and POST /v1/embeddings, and wires explicit model overrides through both /v1/chat/completions and /v1/responses. It also enables x-openclaw-message-channel support on the responses endpoint, bringing it into parity with chat completions. The implementation follows existing patterns cleanly (auth helpers, handler dispatch, rate-limiting), and the new endpoints are gated behind the same openAiCompatEnabled flag as the existing endpoints.

Key points from the review:

  • Error message leakage (embeddings-http.ts, line 530–536): the catch block sends String(err) directly to the client. Even behind auth, raw error strings can surface provider API error details or internal paths. Recommend logging the full error server-side and returning a generic message.
  • Stale mock reference in test (embeddings-http.test.ts, line 320): mock.calls[0] in the second test points to a call from the first test (the mock is never cleared between tests). The assertion coincidentally passes because both tests happen to use the same provider/model. mock.calls.at(-1) would correctly target the current test's invocation.
  • The created: 0 field on model objects is technically valid per the docs pattern but may display as epoch on some clients — using Math.floor(Date.now() / 1000) would be more conventional.
  • The useMessageChannelHeader flip on responses (false → true) is a deliberate behavior change for x-openclaw-message-channel; the test update correctly reflects this.

Confidence Score: 4/5

  • Safe to merge after addressing the raw error exposure in the embeddings catch block; all other changes are well-structured and correctly tested.
  • The core feature additions (models, embeddings, model override forwarding) are implemented cleanly and follow existing gateway patterns. Auth, rate limiting, and handler dispatch are all correctly wired. One P1 concern exists: raw error messages from the embedding provider are forwarded to the client, which could leak internal details. The test correctness issue (stale mock reference) is a P2 but does not affect production behaviour. The behaviour change on x-openclaw-message-channel for responses is intentional and properly documented.
  • src/gateway/embeddings-http.ts (catch block error exposure) and src/gateway/embeddings-http.test.ts (stale mock.calls[0] reference)

Comments Outside Diff (2)

  1. src/gateway/embeddings-http.ts, line 530-536 (link)

    P1 Raw error message exposed to client

    The catch block forwards String(err) directly in the HTTP response body. Even though this endpoint is behind bearer auth, raw error strings can leak internal implementation details — stack traces, file paths, internal function names, or provider API keys that surfaced as part of the error message.

    Consider returning a generic message while logging the full error server-side:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/gateway/embeddings-http.ts
    Line: 530-536
    
    Comment:
    **Raw error message exposed to client**
    
    The `catch` block forwards `String(err)` directly in the HTTP response body. Even though this endpoint is behind bearer auth, raw error strings can leak internal implementation details — stack traces, file paths, internal function names, or provider API keys that surfaced as part of the error message.
    
    Consider returning a generic message while logging the full error server-side:
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. src/gateway/embeddings-http.test.ts, line 320-324 (link)

    P2 mock.calls[0] references the wrong invocation

    createEmbeddingProviderMock is never cleared between tests, so by the time this second test runs, mock.calls[0] already points to the first call from the "embeds string and array inputs" test (which also used provider: "openai", model: "text-embedding-3-small"). The assertion coincidentally passes, but it is not actually verifying the call made by this test.

    Use mock.calls.at(-1) to target the most recent call, or add a vi.clearAllMocks() in a beforeEach:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/gateway/embeddings-http.test.ts
    Line: 320-324
    
    Comment:
    **`mock.calls[0]` references the wrong invocation**
    
    `createEmbeddingProviderMock` is never cleared between tests, so by the time this second test runs, `mock.calls[0]` already points to the first call from the `"embeds string and array inputs"` test (which also used `provider: "openai"`, `model: "text-embedding-3-small"`). The assertion coincidentally passes, but it is not actually verifying the call made by this test.
    
    Use `mock.calls.at(-1)` to target the most recent call, or add a `vi.clearAllMocks()` in a `beforeEach`:
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/gateway/embeddings-http.ts
Line: 530-536

Comment:
**Raw error message exposed to client**

The `catch` block forwards `String(err)` directly in the HTTP response body. Even though this endpoint is behind bearer auth, raw error strings can leak internal implementation details — stack traces, file paths, internal function names, or provider API keys that surfaced as part of the error message.

Consider returning a generic message while logging the full error server-side:

```suggestion
  } catch (err) {
    console.error("[embeddings] provider error:", err);
    sendJson(res, 500, {
      error: {
        message: "An error occurred while generating embeddings.",
        type: "api_error",
      },
    });
  }
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/gateway/embeddings-http.test.ts
Line: 320-324

Comment:
**`mock.calls[0]` references the wrong invocation**

`createEmbeddingProviderMock` is never cleared between tests, so by the time this second test runs, `mock.calls[0]` already points to the first call from the `"embeds string and array inputs"` test (which also used `provider: "openai"`, `model: "text-embedding-3-small"`). The assertion coincidentally passes, but it is not actually verifying the call made by this test.

Use `mock.calls.at(-1)` to target the most recent call, or add a `vi.clearAllMocks()` in a `beforeEach`:

```suggestion
    const firstCall = createEmbeddingProviderMock.mock.calls.at(-1)?.[0] as
      | { provider?: string; model?: string }
      | undefined;
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Update index.md" | Re-trigger Greptile

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

Copy link
Copy Markdown
Contributor

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: 93001b17f8

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/http-utils.ts Resolved
Comment thread src/gateway/embeddings-http.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: 506bbd2323

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/http-utils.ts Resolved
Comment thread src/gateway/embeddings-http.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: dac07d0585

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +64
const cfg = loadConfig();
const catalog = await loadGatewayModelCatalog();
const agentId = resolveAgentIdForRequest({ req, model: undefined });
const { allowedCatalog } = buildAllowedModelSet({
cfg,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Use agent default provider when filtering model list

loadAllowedCatalog passes DEFAULT_PROVIDER into buildAllowedModelSet, so bare allowlist entries are interpreted as Anthropic even when the selected agent’s runtime default provider is different. In configs like agents.defaults.model.primary = "openai/gpt-5.4" with a bare allowlist key ("gpt-5.4"), /v1/models can emit the wrong synthetic ID (anthropic/gpt-5.4) and hide the actually allowed model. This breaks OpenAI-compatible picker round-trips for non-Anthropic defaults.

Useful? React with 👍 / 👎.

@vincentkoc
vincentkoc merged commit eaad4ad into main Mar 24, 2026
42 checks passed
@vincentkoc
vincentkoc deleted the vincentkoc-code/openapi-channel-investigation branch March 24, 2026 23:53
kvokka pushed a commit to kvokka/openclaw that referenced this pull request Mar 25, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
netandreus pushed a commit to netandreus/openclaw that referenced this pull request Mar 25, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
npmisantosh pushed a commit to npmisantosh/openclaw that referenced this pull request Mar 25, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
jacobtomlinson pushed a commit to jacobtomlinson/openclaw that referenced this pull request Mar 25, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
godlin-gh pushed a commit to YouMindInc/openclaw that referenced this pull request Mar 27, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
goweii pushed a commit to goweii/openclaw that referenced this pull request May 24, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…beddings) (openclaw#53992)

* feat(gateway): add OpenAI-compatible models and embeddings

* docs(gateway): clarify model list and agent routing

* Update index.md

* fix(gateway): harden embeddings HTTP provider selection

* fix(gateway): validate compat model overrides

* fix(gateway): harden embeddings and response continuity

* fix(gateway): restore compat model id handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant