1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Rust SDK for the Codex CLI.
//!
//! This crate wraps the `codex` command-line tool, reading JSONL events from
//! stdout when invoked with `codex exec --json`. Unlike the Claude SDK, this
//! is **unidirectional** — the prompt goes as a CLI argument and stdin is
//! `/dev/null`.
//!
//! # Quick start
//!
//! ```rust,no_run
//! use apiari_codex_sdk::{CodexClient, ExecOptions, Event, Item};
//!
//! # async fn run() -> apiari_codex_sdk::error::Result<()> {
//! let client = CodexClient::new();
//! let mut execution = client.exec("List files in the current directory", ExecOptions {
//! model: Some("o4-mini".into()),
//! full_auto: true,
//! ..Default::default()
//! }).await?;
//!
//! while let Some(event) = execution.next_event().await? {
//! match &event {
//! Event::ItemCompleted { item: Item::AgentMessage { text, .. } } => {
//! if let Some(text) = text {
//! println!("{text}");
//! }
//! }
//! Event::TurnCompleted { usage } => {
//! if let Some(usage) = usage {
//! println!("Tokens: {} in, {} out", usage.input_tokens, usage.output_tokens);
//! }
//! }
//! _ => {}
//! }
//! }
//! # Ok(())
//! # }
//! ```
// Re-export the most commonly used types at the crate root.
pub use ;
pub use ;
pub use ;
pub use ;