PYPYLAB
OPEN SOURCE

P02 · LLM Protocol Infrastructure

Codex-Shim

一个刻意保持窄边界的 Responses-to-Chat 兼容层,让 Codex CLI 对接 OpenAI-compatible Chat Completions provider,同时明确暴露不支持的 control-plane 行为。

RustResponses APIChat CompletionsTool CallingSSEProtocol AdapterCompatibility Engineering
PROTOCOL FLOW

转换协议语义,而不只是 JSON 字段。

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

有效的兼容面

覆盖 instructions、token controls、function tools、function-call outputs、previous-response continuation、reasoning content 与 buffered Responses SSE。

Explicitly unsupported

不伪造 Remote Compact

Compact control-plane 请求被明确标记为 unsupported,而不是盲目转发或伪装成 provider failure。

SURFACE

保持小 API Surface,并让失败语义可见。

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

Tool Call 映射

Chat tool call 转换为 Responses function-call item,function-call output 再映射回 Chat tool message。

State

Continuation

通过内存 continuation model 支持 previous response ID,匹配该 shim 的窄职责边界。

Release

可验证交付物

Release archive 同时提供 checksum 与 build information,方便直接验证开源交付证据。