Skip to main content

Module key_auth

Module key_auth 

Source
Expand description

API-key credentials of the providers whose setup is more than one key in one environment variable: Amazon Bedrock, Google Vertex AI, the two Cloudflare providers, llama.cpp, and Anthropic’s workload identity federation.

Ports of the ApiKeyAuth objects in providers/amazon-bedrock.ts, google-vertex.ts, cloudflare-auth.ts and anthropic.ts in pi-ai, and of extensions/llama/provider.ts in pi-coding-agent, v1.0.0.

Structs§

Ambient
What resolution reads besides the stored credential.
Resolved
Request credentials from a stored credential or the environment.

Functions§

anthropic_federation
Anthropic’s last resort when no key or token is set: workload identity federation, whose ids pass to the request as provider settings.
cloudflare_base_url
Replaces Cloudflare’s {CLOUDFLARE_ACCOUNT_ID} and {CLOUDFLARE_GATEWAY_ID} placeholders in a base URL with the request’s provider settings. Port of resolveCloudflareModel.
is_custom
Whether provider’s key auth is resolved here rather than from its key variables.
login
pi’s login for a custom provider: the questions that build its stored credential. None when the provider is not custom.
resolve
pi’s resolve for a custom provider: from credential, whose key is already resolved, else the environment. None when the provider is not configured or is not custom.