Configuration
This page lists every option in one place. For step-by-step usage examples, see Getting Started.
You typically configure two layers:
- Client setup (
CodexOptions) when you create theCodexinstance. - Thread and turn behavior (
ThreadOptions,TurnOptions) when you run prompts.
CodexOptions
Use these to control how the CLI process is launched.
CodexPathOverride: full path to thecodexbinary.BaseUrl: override the base URL used by the CLI.ApiKey: API key forwarded to the CLI (optional if thecodexCLI already has a signed-in ChatGPT session with Codex access).Env: environment variables passed to the CLI. When set, the process does not inherit the host environment.
CLI binary location
By default, the SDK looks for codex under vendor/<target-triple>/codex/ relative to your application output. If your binary lives elsewhere, set CodexPathOverride when you construct the Codex client.
Remember that you can download the latest binary here
ThreadOptions
Use these when you create or resume a thread.
Model: model name passed to the CLI.SandboxMode: sandbox policy (ReadOnly,WorkspaceWrite,DangerFullAccess).WorkingDirectory: working directory for the CLI process.SkipGitRepoCheck: skip the Git repository check in the CLI.ModelReasoningEffort: reasoning effort hint (Minimal,Low,Medium,High,XHigh).NetworkAccessEnabled: allow network access in workspace-write mode.WebSearchMode:Disabled,Cached, orLive.WebSearchEnabled: legacy toggle (true=> live,false=> disabled).ApprovalPolicy: approval mode (Never,OnRequest,OnFailure,Untrusted).AdditionalDirectories: extra directories passed via--add-dir.
TurnOptions
Use these per call to RunAsync or RunStreamedAsync.
OutputSchema: JSON schema object for structured output.CancellationToken: cancellation token for the turn.