Skip to content

feat(codex): accept a host-supplied model provider endpoint - #1231

Closed
wujiaming-ai wants to merge 1 commit into
mainfrom
feat/codex-provider-api-for-superagent-20261119
Closed

wujiaming-ai wants to merge 1 commit into
mainfrom
feat/codex-provider-api-for-superagent-20261119

Conversation

@wujiaming-ai

Copy link
Copy Markdown
Collaborator

A host that fronts the model API (for example a per-invocation proxy that owns tool policy) needs Codex to send Responses API traffic to that proxy instead of the configured model API base, and needs its own tool executors wrapped before they are published over the MCP bridge.

Add an optional provider_factory to CodexRuntimeConfig. It returns an async context manager that yields a CodexProviderEndpoint -- base URL, per-invocation token, an handles_extra_body declaration and an optional wrap_tool_executor hook. The endpoint replaces the model API base for the direct transport, is entered before the Codex home is written and closed after Codex has stopped issuing requests, and every ADK tool executor is wrapped before the bridge sees it.

The endpoint is validated (http(s), https off loopback, no credentials in the URL, no control characters in the key) and its token never appears in repr. shell_enabled=False now requires a provider factory because only the provider can reject Codex's native shell tool calls; the endpoint also cannot be combined with the shim transport.

A host that fronts the model API (for example a per-invocation proxy that
owns tool policy) needs Codex to send Responses API traffic to that proxy
instead of the configured model API base, and needs its own tool executors
wrapped before they are published over the MCP bridge.

Add an optional ``provider_factory`` to ``CodexRuntimeConfig``. It returns
an async context manager that yields a ``CodexProviderEndpoint`` -- base
URL, per-invocation token, an ``handles_extra_body`` declaration and an
optional ``wrap_tool_executor`` hook. The endpoint replaces the model API
base for the direct transport, is entered before the Codex home is written
and closed after Codex has stopped issuing requests, and every ADK tool
executor is wrapped before the bridge sees it.

The endpoint is validated (http(s), https off loopback, no credentials in
the URL, no control characters in the key) and its token never appears in
``repr``. ``shell_enabled=False`` now requires a provider factory because
only the provider can reject Codex's native shell tool calls; the endpoint
also cannot be combined with the shim transport.
@wujiaming-ai
wujiaming-ai deleted the feat/codex-provider-api-for-superagent-20261119 branch November 20, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant