Repository navigation
Description
Client or integration
Codex CLI
Provider or upstream service
opengateway (Sionic AI OpenGateway; provider adapter: "openai-chat" in the shipped preset). Observed with the responses-native route for deepseek/deepseek-v4.1-flash-ultrafast and z-ai/glm-5.3-flash-ultrafast.
OpenCodex version
Observed on 2.81.0 (installed @bitkyc08/opencodex, shipped preset).
Endpoint or capability
POST /v1/responses: any routed opengateway turn on the responses-native path that replays Codex code-mode exec history (custom_tool_call / custom_tool_call_output items).
Current behaviour
On the responses-native path, the opengateway preset has no supportsResponsesCustomTools value, so routed custom tools (exec) are passed through unchanged. From the second request onward, once the history carries custom_tool_call / custom_tool_call_output items, OpenGateway rejects the request:
- first turn: 200
- second request (tool result present in history): 400
invalid_request_error,failureCause: payload-rejected, upstream answers in ~91ms
The same request succeeds when the custom tool is lowered to a function first, which is exactly what supportsResponsesCustomTools: false does. Models routed through the openai-chat (translated) path never fail this way under the same conditions, which is consistent with the lowering being the difference.
Discovered while routing Codex to opengateway ultrafast models. Working around it today with a per-model adapter override to openai-chat.
Expected behaviour
The opengateway preset should declare that the upstream does not accept native custom/custom_tool_call shapes, so OpenCodex lowers routed custom tools to functions (the same behaviour the preset already uses for xAI):
// OpenGateway rejects native custom/custom_tool_call history items while accepting the
// otherwise-identical request after the custom tool is lowered to a function.
supportsResponsesCustomTools: false,Minimal redacted request or reproduction
- Configure the
opengatewayprovider with a key and use a model on the responses-native path (no per-model adapter override). - In Codex CLI, send a turn that performs one
exec(code mode) round-trip, so the next request replayscustom_tool_call/custom_tool_call_outputin history. - The first turn returns 200; the second request returns 400.
Reduced request shape of the failing second request (redacted, no key):
POST https://apis.opengateway.ai/v1/responses
content-type: application/json
authorization: Bearer <redacted>
{"model":"deepseek/deepseek-v4.1-flash-ultrafast","input":[
{"type":"message","role":"user","content":[{"type":"input_text","text":"..."}]},
{"type":"custom_tool_call","call_id":"call_A","name":"exec","input":"..."},
{"type":"custom_tool_call_output","call_id":"call_A","output":"..."},
{"type":"message","role":"user","content":[{"type":"input_text","text":"continue"}]}
], ...}
Actual response or error
HTTP 400
{"error":{"type":"invalid_request_error","message":"..."}} // failureCause: payload-rejected, ~91ms
The identical history returns 200 once the adapter lowers the custom tool to a function (for example with a per-model modelAdapters override to openai-chat or by setting supportsResponsesCustomTools: false).
Upstream documentation
No public OpenGateway specification for the responses-native custom-tool shape was found; the evidence here is the observed 400 and the successful function-lowered retry. The lowering contract on the OpenCodex side is internal:
src/adapters/openai-responses/passthrough.ts(rewriteRoutedCustomToolsForUpstream,validateFinalCustomToolCompatibility) passes the provider flagsrc/responses/custom-tool-compat.tslowers routed custom tools to functions when the flag isfalsesrc/router.tslets a config value override the registry value
Suggested mapping or implementation notes
The xAI entry already carries the same flag for the same reason:
// src/providers/registry/entries-core.ts
supportsResponsesCustomTools: false, // "xAI rejects native custom/custom_tool_call shapes while accepting
// the otherwise-identical request after the custom tool is lowered to a function."Adding the flag to the opengateway entry (instead of, or in addition to, a per-model openai-chat override) makes the preset work with no operator-side override. Scope: only the opengateway provider; other providers are unchanged. unsupportedHostedTools and similar fields are out of scope for this report.
Additional context and attachments
Operator workaround currently in use: ocx config set providers.opengateway.supportsResponsesCustomTools false (once applied) or a modelAdapters override to openai-chat for the affected models.
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on an upstream specification or a concrete client requirement.
Activity
fix(opengateway): lower routed custom tools on the Responses wire (#6877
lidge-jun commentedon Oct 10, 2026
Fixed on
devby #6879 (squash696dadc88f). The opengateway preset now setssupportsResponsesCustomTools: false, so Codexcustom_tool_callhistory is no longer sent to an endpoint that rejects it.