Codex.Options (Codex SDK v0.3.0)

View Source

Global configuration for Codex interactions.

Options are built from caller-supplied values merged with environment defaults.

Summary

Functions

Determines the executable path to codex-rs.

Builds a validated options struct.

Types

t()

@type t() :: %Codex.Options{
  api_key: String.t() | nil,
  base_url: String.t(),
  codex_path_override: String.t() | nil,
  model: String.t() | nil,
  reasoning_effort: Codex.Models.reasoning_effort() | nil,
  telemetry_prefix: [atom()]
}

Functions

codex_path(opts)

@spec codex_path(t()) :: {:ok, String.t()} | {:error, term()}

Determines the executable path to codex-rs.

Order of precedence:

  1. Explicit override on the struct.
  2. CODEX_PATH environment variable.
  3. System.find_executable("codex").

new(attrs \\ %{})

@spec new(map() | keyword()) :: {:ok, t()} | {:error, term()}

Builds a validated options struct.

The API key is required. It can be provided directly or via the CODEX_API_KEY environment variable.