Skip to main content

Module credentials

Module credentials 

Source
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§

ConfigCredentials
What the provider entry in settings.json says: the environment variable its api_key_env names — ANTHROPIC_AUTH_TOKEN / ANTHROPIC_API_KEY for the built-in provider. The default source.
ConfigThen
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.
StaticCredentials
Answers from a map given up front.

Traits§

CredentialSource
Where a provider’s credential comes from.