Skip to main content

codex_sdk_rs/
lib.rs

1//! Rust port of the public `OpenAI Codex` Python SDK.
2//!
3//! [`AsyncCodex`] is the asynchronous client. With the default `blocking`
4//! feature, [`Codex`] provides the synchronous API familiar to Python SDK
5//! users.
6
7mod async_client;
8#[cfg(feature = "blocking")]
9mod blocking;
10mod config;
11mod error;
12mod options;
13mod transport;
14mod types;
15
16pub use async_client::{
17    AsyncChatgptLoginHandle, AsyncCodex, AsyncDeviceCodeLoginHandle, AsyncThread, AsyncTurnHandle,
18    TurnStream, retry_on_overload,
19};
20#[cfg(feature = "blocking")]
21pub use blocking::{
22    ChatgptLoginHandle, Codex, DeviceCodeLoginHandle, Thread, TurnHandle, TurnIter,
23};
24pub use config::{ApprovalHandler, CodexConfig};
25pub use error::{Error, JsonRpcError, JsonRpcErrorKind, Result, is_retryable_error};
26pub use options::{
27    ThreadForkOptions, ThreadListOptions, ThreadResumeOptions, ThreadStartOptions, TurnOptions,
28};
29pub use types::*;
30
31/// Crate version sent in the app-server initialize handshake by default.
32pub const VERSION: &str = env!("CARGO_PKG_VERSION");
33
34/// Exact `openai/codex` revision used for this port's Python SDK contract.
35pub const UPSTREAM_PYTHON_SDK_COMMIT: &str = "f0c30e528a54bdf0fa9a4d52ff74b34383434811";