Codex.Options (Codex SDK v0.6.0)

Copy Markdown 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{
  agent_max_threads: pos_integer() | nil,
  api_key: String.t() | nil,
  base_url: String.t(),
  codex_path_override: String.t() | nil,
  hide_agent_reasoning: boolean(),
  history_max_bytes: non_neg_integer() | nil,
  history_persistence: String.t() | nil,
  model: String.t() | nil,
  model_auto_compact_token_limit: pos_integer() | nil,
  model_context_window: pos_integer() | nil,
  model_personality: Codex.Protocol.ConfigTypes.personality() | nil,
  model_reasoning_summary: String.t() | nil,
  model_supports_reasoning_summaries: boolean() | nil,
  model_verbosity: String.t() | nil,
  reasoning_effort: Codex.Models.reasoning_effort() | nil,
  review_model: String.t() | nil,
  telemetry_prefix: [atom()],
  tool_output_token_limit: pos_integer() | nil
}

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.

API keys are optional. When omitted, the Codex CLI relies on your existing codex login (ChatGPT tokens stored in auth.json).