Repository navigation
Description
What variant of Codex are you using?
CLI, IDE Extension (VS Code), Desktop App
Environment Details
- Platform: Microsoft Windows NT 10.0.26200.0 x64 (Windows 11 Professional)
- Codex CLI: 0.155.0 / 0.156.1
- VS Code Extension: openai.chatgpt 26.917.62051
- Desktop App: 26.917.8451.0
- Terminal: PowerShell 7.6 / Windows Terminal / VS Code Integrated Terminal
- Subscription / Auth: ChatGPT (Plus / Pro)
- Parent Model: gpt-5.5 / gpt-6-luna (provider: openai)
What feature would you like to see?
We would like Codex to permit subagent roles (configured in .codex/agents/<role>.toml, e.g., worker.toml, explorer.toml, or custom roles) to specify and use alternative or local OpenAI-compatible model providers (such as local proxies/routers, Ollama, LM Studio, vLLM), even when the main coordinator/parent thread is authenticated via a ChatGPT subscription account (auth_provider = "chatgpt").
Currently, when the ChatGPT parent agent attempts to delegate tasks to a subagent role that declares a custom provider/model, the tool dispatcher blocks the spawn:
ERROR codex_core::tools::router: error=The selected agent uses a non-OpenAI model provider; retry with the corresponding `external_agents` collaboration tool.
Steps to Reproduce
- Configure a subagent role in
~/.codex/agents/worker.toml:model = "custom-subagent-model" provider = "my-local-gateway"
- In Codex (CLI, VS Code, or Desktop), start a session authenticated with ChatGPT (
chatgpt.comauth mode, modelgpt-5.5orgpt-6-luna). - Issue a prompt requiring parallel subagent delegation:
"Please delegate to a worker subagent to inspect package.json and summarize dependencies." - The parent model attempts to invoke the delegation tool, but
codex_core::tools::routerintercepts the call and fails with:
error=The selected agent uses a non-OpenAI model provider; retry with the corresponding 'external_agents' collaboration tool.
Expected Behavior
Codex should permit the spawned subagent thread to initialize with the provider and endpoint configured in its role definition file (.codex/agents/<role>.toml), allowing hybrid multi-agent delegation without requiring the parent coordinator to switch away from its primary ChatGPT subscription session.
Value & Use Case
- Quota & Efficiency Optimization: Multi-agent delegation often handles repetitive, read-heavy, or exploratory subtasks (e.g. searching large file trees, summarizing lockfiles, running localized linters). Allowing subagents to use local or developer-routed models preserves primary ChatGPT reasoning quota for the coordinator.
- Hybrid Multi-Agent Architectures: Developers can leverage state-of-the-art OpenAI models for high-level reasoning and planning, while delegating high-volume bounded subtasks to self-hosted or domain-specialized models.
Proposed Solutions
- Allow
codex-rs/core/src/tools/router.rsto route subagent creation requests to the client instance associated with the role's declared provider. - Alternatively, provide an explicit configuration opt-in in
config.toml:[multi_agent] allow_cross_provider_subagents = true
Activity
jamesruan0325-design commentedon Sep 25, 2026
Hey — I saw your Codex multi-provider setup and the idea of keeping the coordinator on Codex while routing high-volume subagent work through another OpenAI-compatible provider. I’m building BGYHub, a pay-as-you-go multi-model API gateway, and your workflow is almost exactly the kind of setup I’m trying to validate.
If you’re interested, I can give you $3 test credit, no card required. I’d mainly be interested in whether the gateway works cleanly with your Codex custom-provider configuration and where compatibility breaks — not trying to replace your main Codex subscription.
Ayoro commentedon Nov 25, 2026
Please let native v2
spawn_agentselect a configuredmodel_providerper child, either directly or through a custom role. Our use case is to keep the Codex Desktop parent signed in with ChatGPT while routing selected workers to a Responses-compatible gateway. The child should receive readable task messages and retain the native agent tree, completion notifications, and sandbox behavior.iqdoctor commentedon Nov 27, 2026
+1, still present on
codex-cli 0.172.0(macOS).Concrete hybrid setup we are trying to use:
gpt-6-lunavia the OpenAI/ChatGPT sessiondeepseek-flashvia[model_providers.deepseek]base_url = "https://api.deepseek.com/v1"wire_api = "responses"env_key = "DEEPSEEK_API_KEY"base_url = "https://ai.api.cloud.yandex.net/v1"wire_api = "responses"env_key = "YANDEX_API_KEY"These providers currently work in separate
CODEX_HOMEprofiles, but we want one native thread tree where the parent stays on Luna and selected workers use either DeepSeek or Yandex.This is not only a documentation gap. An agent-role TOML can contain
model_providerbecause the role config is deserialized asConfigToml, but the override path incodex-rs/core/src/agent/role.rsonly forwardsmodel, reasoning, instructions, personality, service tier, features, and skills.child_config.rsthen sets the child provider from the parent turn, and tests explicitly assert that the child provider remains equal to the parent provider. As a result,model_providerin a role file is silently ineffective.Backward-compatible proposal:
model_providertospawn_agentarguments; default to the parent provider.model_providerin standalone agent-role TOMLs andagents.<role>.config_file.[model_providers.<id>]in the activeconfig.toml, includingbase_url,env_key/auth, andwire_api.Related reports: #40858, #17598, #34833, #36387. The workaround of spawning a separate
codex execworker loses native subagent notifications and lifecycle management, so first-class support would be materially better.