Summary
When a provider config declares both an anthropic: and openai: family, _apply_provider_to_pi (omnigent/runtime/workflow.py) always selects anthropic: as pi's single auth/base-URL source, regardless of which model the agent spec actually requests. Any non-Anthropic model then gets routed to the anthropic-messages endpoint and fails with a bare 404 status code (no body).
Root cause
The current gateway can serve multiple models, both Anthropic and OpenAI-family, from the same base URL. PiExecutor's gateway path generates a fresh models.json into a temp PI_CODING_AGENT_DIR, built entirely from HARNESS_PI_GATEWAY_BASE_URLS — which _apply_provider_to_pi populates with at most one family's base URL, preferring anthropic: whenever both are present on the provider. This throws away pi's native ability to route different models to different wire protocols from a single models.json.
Repro
- Configure one provider with both families pointed at the same gateway base URL:
providers:
my-gateway:
anthropic: {api_key_ref: ..., base_url: https://gateway.example.com/}
openai: {api_key_ref: ..., base_url: https://gateway.example.com/, models: {default: some-glm-model}, wire_api: chat}
default: true
kind: gateway
- Run an agent with
executor: {model: some-glm-model, auth: {type: provider, name: my-gateway}, config: {harness: pi}}
- Observe
inner executor error: 404 status code (no body)
Current workaround
Split into two providers, one per family, and pin the right one per agent spec via executor.auth. Works, but forces N providers for N wire families sharing one gateway.
Suggested fix
_apply_provider_to_pi (or PiExecutor._build_models_json) should emit a models.json with one entry per configured family, each carrying its own base URL/auth/wire API, instead of collapsing to a single family upfront.
Environment
- Harness:
pi (SDK/headless path via PiExecutor)
- Relevant files:
omnigent/runtime/workflow.py::_apply_provider_to_pi, omnigent/inner/pi_executor.py::_build_models_json
Summary
When a provider config declares both an
anthropic:andopenai:family,_apply_provider_to_pi(omnigent/runtime/workflow.py) always selectsanthropic:as pi's single auth/base-URL source, regardless of which model the agent spec actually requests. Any non-Anthropic model then gets routed to the anthropic-messages endpoint and fails with a bare404 status code (no body).Root cause
The current gateway can serve multiple models, both Anthropic and OpenAI-family, from the same base URL.
PiExecutor's gateway path generates a freshmodels.jsoninto a tempPI_CODING_AGENT_DIR, built entirely fromHARNESS_PI_GATEWAY_BASE_URLS— which_apply_provider_to_pipopulates with at most one family's base URL, preferringanthropic:whenever both are present on the provider. This throws away pi's native ability to route different models to different wire protocols from a singlemodels.json.Repro
executor: {model: some-glm-model, auth: {type: provider, name: my-gateway}, config: {harness: pi}}inner executor error: 404 status code (no body)Current workaround
Split into two providers, one per family, and pin the right one per agent spec via
executor.auth. Works, but forces N providers for N wire families sharing one gateway.Suggested fix
_apply_provider_to_pi(orPiExecutor._build_models_json) should emit amodels.jsonwith one entry per configured family, each carrying its own base URL/auth/wire API, instead of collapsing to a single family upfront.Environment
pi(SDK/headless path viaPiExecutor)omnigent/runtime/workflow.py::_apply_provider_to_pi,omnigent/inner/pi_executor.py::_build_models_json