Skip to content

feat: add provider-scoped environment overrides#5807

Merged
mitsuhiko merged 3 commits into
mainfrom
per-provider-env
Jun 16, 2026
Merged

feat: add provider-scoped environment overrides#5807
mitsuhiko merged 3 commits into
mainfrom
per-provider-env

Conversation

@mitsuhiko

Copy link
Copy Markdown
Member

This adds provider-scoped environment overrides for Pi. API key credentials in auth.json can now include an env object, and stream options support env directly. These values take precedence over process environment variables for provider configuration, API key lookup, headers, Cloudflare URL placeholders, Azure OpenAI settings, Google Vertex project/location and credentials path, Amazon Bedrock settings, cache retention (PI_CACHE_RETENTION), and proxy configuration (HTTP_PROXY, HTTPS_PROXY).

In order to facilitate this, I also cleaned up code slightly along the way. This centralizes provider env lookup in pi-ai, including the existing Bun sandbox /proc/self/environ fallback for direct library consumers that do not go through the Pi coding-agent Bun entrypoint. There were some cases where we skipped over that logic which looked unintentional.

Fixes #5728

@vegarsti vegarsti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and correct

Comment thread packages/ai/src/providers/amazon-bedrock.ts Outdated
@mitsuhiko mitsuhiko merged commit 7f29e7a into main Jun 16, 2026
1 check passed
@mitsuhiko mitsuhiko deleted the per-provider-env branch June 16, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support provider-specific config in auth.json

2 participants