pub struct OpenAiConfig {
pub enabled: bool,
pub codex_auth_path: Option<PathBuf>,
pub accounts: Vec<OpenAiAccount>,
pub show_default_account: bool,
pub admin_key_env: String,
}Fields§
§enabled: bool§codex_auth_path: Option<PathBuf>Override the Codex auth file path (defaults to ~/.codex/auth.json).
accounts: Vec<OpenAiAccount>Extra Codex logins, each its own auth.json. Same shape as
AnthropicAccount and for the same reason: Codex is an OAuth vendor,
so an account is a credential file, and openai::creds::write_back
refreshes into whichever one it read.
show_default_account: boolWhether the default (unnamed) Codex login gets its own tab. Defaults to
true. Set false once every login is a named account — typically
after account add <label> --codex --adopt-current — so the default
~/.codex/auth.json does not also appear as a second copy of whichever
account is active. Ignored when there are no named accounts.
admin_key_env: StringReserved, and inert: names the env var an API-key-only path would
read (admin key → /v1/organization/costs). Nothing consumes it —
OpenAI usage comes solely from Codex OAuth. Kept because that path is
still intended, not for back-compat: [openai] doesn’t deny unknown
fields, so an existing admin_key_env would load either way. See
config.example.toml, which ships it commented out so nobody sets it
expecting an effect.
Implementations§
Source§impl OpenAiConfig
impl OpenAiConfig
Sourcepub fn resolve_auth_path(&self, label: Option<&str>) -> Result<PathBuf>
pub fn resolve_auth_path(&self, label: Option<&str>) -> Result<PathBuf>
The auth file for label, or the singular/default one when label is
None. An unknown label is an error rather than a silent fall back to
the default account, which would report the wrong login’s usage.
Sourcepub fn fetch_auth_path(&self, label: Option<&str>) -> Result<PathBuf>
pub fn fetch_auth_path(&self, label: Option<&str>) -> Result<PathBuf>
The auth file a fetch for label reads. Unlike
resolve_auth_path, this follows
account switch --codex: the active account’s login has been moved
into the default slot, so it is read there. The answer holds only while
no switch runs, so a fetch asks it under the credentials lock; see
fetch_snapshot_routed.
Sourcepub fn fetch_auth_path_probing(
&self,
label: &str,
active: Option<&str>,
exists: impl Fn(&Path) -> bool,
) -> Result<PathBuf>
pub fn fetch_auth_path_probing( &self, label: &str, active: Option<&str>, exists: impl Fn(&Path) -> bool, ) -> Result<PathBuf>
The pure core of fetch_auth_path,
with the active label and the file probe injected. The own file is
probed rather than assumed gone: an account signed in again under its
own CODEX_HOME keeps reading that file.
Trait Implementations§
Source§impl Clone for OpenAiConfig
impl Clone for OpenAiConfig
Source§impl Debug for OpenAiConfig
impl Debug for OpenAiConfig
Source§impl Default for OpenAiConfig
impl Default for OpenAiConfig
Source§impl<'de> Deserialize<'de> for OpenAiConfigwhere
OpenAiConfig: Default,
impl<'de> Deserialize<'de> for OpenAiConfigwhere
OpenAiConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for OpenAiConfig
impl RefUnwindSafe for OpenAiConfig
impl Send for OpenAiConfig
impl Sync for OpenAiConfig
impl Unpin for OpenAiConfig
impl UnsafeUnpin for OpenAiConfig
impl UnwindSafe for OpenAiConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more