Expand description
CredentialSource — where the engine’s API keys come from.
The default source is the environment: the variable a provider’s
api_key_env names, and ANTHROPIC_AUTH_TOKEN / ANTHROPIC_API_KEY for
the provider the engine supplies when the settings define none. That is fine on a laptop and disqualifying for a host that
is not allowed to have a credential on disk at all — a service pulling
from a vault, an operator injecting per-request identity, anything with
rotation. This trait is the seam such a host replaces.
§The value never comes back as a String
Credentials leak through the boring paths — a {:?} on a config struct, a
telemetry payload built by serializing something that happened to hold one.
Secret exists so that cannot happen by accident: it does not implement
Display, it does not implement Serialize, and its Debug prints
nothing. Reading the value takes Secret::expose, which is verbose on
purpose — a call to it is a place to look during review.
Structs§
- Config
Credentials - What the provider entry in
settings.jsonsays: the environment variable itsapi_key_envnames —ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEYfor the built-in provider. The default source. - Config
Then - The provider entry’s own answer (
ConfigCredentials) first, then a host-supplied source for whatever the entry leaves unset. - EnvCredentials
- Reads the key from the environment, trying each name in turn.
- Secret
- A credential.
- Static
Credentials - Answers from a map given up front.
Traits§
- Credential
Source - Where a provider’s credential comes from.