Skip to main content

Module credentials

Module credentials 

Source
Expand description

Credential values: $VAR and ${VAR} templates, !command output, and the environment variables each provider reads.

Ports of resolve-config-value.ts and env-api-keys.ts in pi v1.0.0.

Constants§

AMBIENT_CREDENTIALS
The key pi reports for providers authenticated by ambient credentials.
BEARER_TOKEN_ENV
The variable Anthropic reads as a bearer token rather than an API key.

Functions§

api_key_env_vars
The environment variables holding a provider’s API key, in priority order. Anthropic’s ANTHROPIC_AUTH_TOKEN is a bearer token, not a key (see BEARER_TOKEN_ENV).
env_api_key
The first set environment variable for a provider’s key, with its name. For providers with ambient credentials (Bedrock, Vertex) the key is AMBIENT_CREDENTIALS.
env_var_names
The environment variables a template value reads.
is_command
Whether the value runs a command.
is_configured
Whether every variable the value reads is set.
missing_env_vars
The variables the value reads that are not set.
provider_env_value
A provider setting: env’s value, else the process environment’s. Empty values count as unset. Port of getProviderEnvValue.
resolve
Resolves a value: !command runs through the shell (cached when cache), anything else is a template whose variables must all be set.
resolve_template
Resolves a template value, or returns None for a !command or when a variable it reads is not set.
unresolved_message
pi’s resolveConfigValueOrThrow message for a value that did not resolve, describing it as description.

Type Aliases§

ProviderEnv
Extra variables that take priority over the process environment.