BigPizzaV3/CodexPlusPlus · error

Chat Completions 协议暂不支持 Responses compact 请求

Error message

Chat Completions 协议暂不支持 Responses compact 请求

What it means

When translating Responses API traffic to a Chat Completions upstream, compact requests (the Responses /compact path, detected by is_responses_compact_proxy_path) have no equivalent translation and are rejected. The function bails if the request path is a compact endpoint and the relay protocol is ChatCompletions.

Solutions

  1. Disable or avoid compact requests when using a Chat Completions protocol profile
  2. Switch the relay profile protocol to Responses for endpoints that issue compact requests
  3. Route compact traffic to a Responses-capable profile/upstream
Defensive patterns

Strategy: validation

Validate before calling

if is_responses_compact_proxy_path(request_path) && relay.protocol == RelayProtocol::ChatCompletions { return Err("compact not supported on chat completions profile"); }

Try / catch

match translate_and_send(...) {
    Err(e) if e.to_string().contains("compact") => eprintln!("Chat Completions 上游不支持 compact,请改用 Responses 协议中转或关闭 compact: {e}"),
    other => other?,
}

Prevention

When it happens

Trigger: A Responses compact request is routed through the proxy while the active relay profile protocol is ChatCompletions, so is_responses_compact_proxy_path(request_path) is true and the protocol check triggers.

Common situations: Codex client issuing context-compaction requests against a Chat Completions-only relay profile; routing config sending /compact paths to a translated upstream.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/73764ca04ffdfab2. Report an issue: GitHub.

Appendix: source

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

    Ok(UpstreamProxyResponse {
        status_code,
        is_stream: is_stream || content_type.contains("text/event-stream"),
        content_type,
        wire_api: UpstreamWireApi::ChatCompletions,
        response: upstream,
    })
}

async fn upstream_request_parts(
    relay: &crate::settings::RelayProfile,
    mut request_json: Value,
    request_path: &str,
    model_override: Option<&str>,
) -> anyhow::Result<(String, Value, UpstreamWireApi)> {
    let compact = is_responses_compact_proxy_path(request_path);
    if compact && relay.protocol == RelayProtocol::ChatCompletions {
        anyhow::bail!("Chat Completions 协议暂不支持 Responses compact 请求");
    }
    if let Some(model) = model_override
        .map(str::trim)
        .filter(|value| !value.is_empty())
    {
        request_json["model"] = json!(model);
    }
    let mut body = match relay.protocol {
        RelayProtocol::Responses => request_json,
        RelayProtocol::ChatCompletions =>
            responses_to_chat_completions_with_options(request_json, relay.standard_openai_protocol)?,
    };
    if relay.protocol == RelayProtocol::Responses {
        normalize_responses_item_ids(&mut body);
    }

    // Image handling (per-model): send-as-is / strip / VLM analysis
    let model = body

View on GitHub (pinned to b1ed92e5e4)