From ec83d022e5be5ca9dd3b9b439ea01040982230b4 Mon Sep 17 00:00:00 2001 From: Anu Kheru Date: Mon, 4 May 2026 11:44:34 -0300 Subject: [PATCH] fix(delegate): recognise MiniMax /anthropic endpoint as anthropic_messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When delegation.base_url is configured, _resolve_delegation_credentials auto-detects provider/api_mode from the URL hostname. Codex, Anthropic and Kimi were handled, but MiniMax's Anthropic-compatible endpoint (api.minimax.io/anthropic, api.minimaxi.com/anthropic) was not — sub- agents fell back to provider=custom + api_mode=chat_completions and POSTed to /v1/chat/completions, which doesn't exist on MiniMax → HTTP 404 page not found after 3 retries. Symptom in prod: GPT-5.5 main agent (Codex) tries to delegate research sub-tasks to MiniMax-M2.7 children via delegate_task. Every child returns 'API call failed after 3 retries. HTTP 404: 404 page not found | provider=custom model=MiniMax-M2.7'. Confirmed during WS9 GPT-5.5 evaluation 2026-05-04 13:55-13:56 UTC. Fix: add a 4th branch matching api.minimax.io / api.minimaxi.com with '/anthropic' in the path, mapping it to provider=minimax and api_mode=anthropic_messages. This makes the child build the correct POST /v1/messages call at /anthropic/v1/messages. The MiniMax model itself was already on prod via env:MINIMAX_API_KEY in the credential pool — only the auto-detection was missing. --- tools/delegate_tool.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py index abdec4717fef..aa0a409a87f1 100644 --- a/tools/delegate_tool.py +++ b/tools/delegate_tool.py @@ -2215,6 +2215,17 @@ def _resolve_delegation_credentials(cfg: dict, parent_agent) -> dict: elif "api.kimi.com/coding" in base_lower: provider = "custom" api_mode = "anthropic_messages" + elif ( + base_url_hostname(configured_base_url) + in ("api.minimax.io", "api.minimaxi.com") + and "/anthropic" in base_lower + ): + # MiniMax exposes an Anthropic-compatible endpoint at /anthropic. + # Without this branch, sub-agents fall back to provider=custom + + # api_mode=chat_completions and POST to /v1/chat/completions → + # HTTP 404 because that path doesn't exist on MiniMax. + provider = "minimax" + api_mode = "anthropic_messages" return { "model": configured_model,