The Codex.Config.Defaults module is the single source of truth for every
tunable constant in the Codex SDK. Instead of scattering magic numbers across
modules, all defaults live in one place and are referenced via zero-arity
function calls.
How It Works
Every default is a public, zero-arity function with a @doc and @spec:
Consuming modules reference these functions either directly or through module
attributes:
# Direct calltimeout=Defaults.mcp_call_timeout_ms()# Module attribute (resolved at compile time)@default_timeout_msDefaults.mcp_call_timeout_ms()
Runtime Overrides
A subset of defaults support runtime override via Application.get_env/3.
These are clearly documented on each function. Override them in
config/runtime.exs:
Not every runtime behavior is a Codex.Config.Defaults constant. Two important upstream-parity
settings live in layered config.toml files instead:
openai_base_url overrides the built-in openai provider base URL and takes precedence over OPENAI_BASE_URL
[model_providers.<id>] entries extend the built-in provider set, but reserved IDs (openai, ollama, lmstudio) are rejected
Custom trust roots are also environment-driven rather than Defaults-driven: CODEX_CA_CERTIFICATE
is preferred over SSL_CERT_FILE, with blank values treated as unset.
OAuth issuer resolution is also separate from openai_base_url: overriding the
OpenAI API base URL does not change the ChatGPT OAuth authority. Use
Codex.OAuthauth_issuer: options (or layered auth_issuer) for that.