mirror of
https://github.com/openai/codex.git
synced 2026-02-01 22:47:52 +00:00
seeing issues with azure after default-enabling web search: #10071, #10257. need to work with azure to fix api-side, for now turning off default-enable of web_search for azure. diff is big because i moved logic to reuse
codex-api
Typed clients for Codex/OpenAI APIs built on top of the generic transport in codex-client.
- Hosts the request/response models and prompt helpers for Responses, Chat Completions, and Compact APIs.
- Owns provider configuration (base URLs, headers, query params), auth header injection, retry tuning, and stream idle settings.
- Parses SSE streams into
ResponseEvent/ResponseStream, including rate-limit snapshots and API-specific error mapping. - Serves as the wire-level layer consumed by
codex-core; higher layers handle auth refresh and business logic.
Core interface
The public interface of this crate is intentionally small and uniform:
-
Prompted endpoints (Chat + Responses)
- Input: a single
Promptplus endpoint-specific options.Prompt(re-exported ascodex_api::Prompt) carries:instructions: String– the fully-resolved system prompt for this turn.input: Vec<ResponseItem>– conversation history and user/tool messages.tools: Vec<serde_json::Value>– JSON tools compatible with the target API.parallel_tool_calls: bool.output_schema: Option<Value>– used to buildtext.formatwhen present.
- Output: a
ResponseStreamofResponseEvent(both re-exported fromcommon).
- Input: a single
-
Compaction endpoint
- Input:
CompactionInput<'a>(re-exported ascodex_api::CompactionInput):model: &str.input: &[ResponseItem]– history to compact.instructions: &str– fully-resolved compaction instructions.
- Output:
Vec<ResponseItem>. CompactClient::compact_input(&CompactionInput, extra_headers)wraps the JSON encoding and retry/telemetry wiring.
- Input:
All HTTP details (URLs, headers, retry/backoff policies, SSE framing) are encapsulated in codex-api and codex-client. Callers construct prompts/inputs using protocol types and work with typed streams of ResponseEvent or compacted ResponseItem values.