BigPizzaV3/CodexPlusPlus · error

模型路由目标必须使用 Responses API:{}

Error message

模型路由目标必须使用 Responses API:{}

What it means

Thrown by select_model_route in crates/codex-plus-core/src/protocol_proxy.rs when a model route's target relay uses a protocol other than RelayProtocol::Responses. Model routes forward the original Responses-API request body (only rewriting the model name), which requires the target to accept the Responses wire format; a ChatCompletions target would need full protocol conversion that the route path does not perform. The placeholder is the target's display name.

Source

Thrown at crates/codex-plus-core/src/protocol_proxy.rs:746

        .find(|route| route.model.trim() == model)
    else {
        return Ok(None);
    };
    let target_relay_id = route.target_relay_id.trim();
    if target_relay_id == source.id {
        anyhow::bail!("模型路由不能指向当前供应商自身:{model}");
    }
    let target = settings
        .relay_profiles
        .iter()
        .find(|profile| profile.id == target_relay_id)
        .cloned()
        .with_context(|| format!("模型路由目标供应商不存在:{target_relay_id}"))?;
    if target.relay_mode == crate::settings::RelayMode::Aggregate {
        anyhow::bail!("模型路由目标不能是聚合供应商:{}", target.name);
    }
    if target.protocol != RelayProtocol::Responses {
        anyhow::bail!("模型路由目标必须使用 Responses API:{}", target.name);
    }

    let upstream_model = if route.target_model.trim().is_empty() {
        model.to_string()
    } else {
        route.target_model.trim().to_string()
    };
    Ok(Some(ModelRouteSelection {
        relay: target,
        source_relay_id: source.id,
        source_model: model.to_string(),
        upstream_model,
    }))
}

pub async fn open_models_proxy_request(
    original_user_agent: Option<&str>,
) -> anyhow::Result<UpstreamProxyResponse> {

View on GitHub (pinned to 1f431ae49b)

Solutions

  1. Change the target relay profile's protocol to Responses (and make sure its upstream really serves the Responses API)
  2. Or repoint the route at a different relay that already uses the Responses protocol
  3. Remove the route if the model should go through the normal protocol-conversion path of the active relay instead
Defensive patterns

Strategy: validation

Validate before calling

fn route_target_uses_responses(settings: &BackendSettings, target_id: &str) -> bool {
    settings
        .relay_profiles
        .iter()
        .any(|p| p.id == target_id && p.protocol == RelayProtocol::Responses)
}

Prevention

When it happens

Trigger: A model_routes entry targeting a relay profile configured with protocol = ChatCompletions; user switched the target provider from Responses to Chat Completions after the route was created.

Common situations: Reusing an old route after the target provider migrated to a chat-completions-only upstream; importing route configs paired with the wrong protocol profiles; relay target pointing at a vendor that only supports /v1/chat/completions.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16). Data as JSON: /api/errors/f6f24573f5742aae. Report an issue: GitHub.