PYPYLAB
OPEN SOURCE

P02 · LLM Protocol Infrastructure

Codex-Shim

A deliberately narrow Responses-to-Chat compatibility layer that lets Codex CLI use OpenAI-compatible Chat Completions providers while keeping unsupported control-plane behavior explicit.

RustResponses APIChat CompletionsTool CallingSSEProtocol AdapterCompatibility Engineering
PROTOCOL FLOW

Translate semantics, not just JSON fields.

Codex CLIResponses client, tool calls, continuation expectations
Codex-ShimMaps request/response semantics and keeps the adapter boundary explicit
Compatible providerChat Completions endpoint and provider-specific reasoning surface
Handled

Useful compatibility surface

Instructions, token controls, function tools, function-call outputs, previous-response continuation, reasoning content and buffered Responses SSE.

Explicitly unsupported

Remote compact is not faked

The compact control-plane request is handled as unsupported instead of being blindly forwarded or misrepresented as provider failure.

SURFACE

Small API surface, visible failure semantics.

GET /healthz GET /v1/models POST /v1/responses GET /v1/responses/{response_id} POST /v1/responses/compact → 501 compact_not_supported
Protocol

Tool call mapping

Chat tool calls become Responses function-call items, and function-call output is translated back into Chat tool messages.

State

Continuation

Previous response IDs are supported through an in-memory continuation model appropriate to the shim's narrow scope.

Release

Verifiable artifacts

Release archives are accompanied by checksums and build information, making the open-source evidence easier to inspect.