Skip to content

Inference parser: Decode a zstd request body for Anthropic and Chat Completions #1705

Closed

Description

@huang195

Problem

inference.ParseRequest decodes a zstd request body only for the Responses API. The Anthropic Messages and Chat Completions parsers get the raw bytes. For a zstd body on those endpoints, json.Unmarshal fails and ParseRequest returns nil. The request then has no inference classification and no request telemetry. The gateway cost header still prices the response.

No listener decompresses a request body before the plugins see it (see the parsercommon.DecodeRequestBody doc comment).

Impact today

None known. Codex is the only client that we saw send zstd, and it sends zstd to the Responses endpoint only. The defect is latent. It becomes live when a client sends a compressed body to /v1/messages or /v1/chat/completions.

Fix decision

Call parsercommon.DecodeRequestBody(headers, body) once in ParseRequest, before the dialect switch. Remove the call from parseResponsesRequest. Add a zstd test case for each dialect.

The base code had the same behaviour. CodeRabbit found it on #1703. That PR is a pure move, so the fix is not in it.

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. added a commit that references this issue on Nov 8, 2026
    472e828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions