diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index 9417c0f4..14e711f7 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- Added `AWS_BEDROCK_SKIP_AUTH` and `AWS_BEDROCK_FORCE_HTTP1` environment variables for connecting to unauthenticated Bedrock proxies ([#1320](https://github.com/badlogic/pi-mono/pull/1320) by [@virtuald](https://github.com/virtuald)) + ### Fixed - Set OpenAI Responses API requests to `store: false` by default to avoid server-side history logging ([#1308](https://github.com/badlogic/pi-mono/issues/1308)) diff --git a/packages/ai/src/providers/amazon-bedrock.ts b/packages/ai/src/providers/amazon-bedrock.ts index 4d356421..fa432787 100644 --- a/packages/ai/src/providers/amazon-bedrock.ts +++ b/packages/ai/src/providers/amazon-bedrock.ts @@ -90,18 +90,18 @@ export const streamBedrock: StreamFunction<"bedrock-converse-stream", BedrockOpt profile: options.profile, }; - // Support proxies that don't need authentication - if (process.env.AWS_BEDROCK_SKIP_AUTH === "1") { - config.credentials = { - accessKeyId: "dummy-access-key", - secretAccessKey: "dummy-secret-key", - }; - } - // in Node.js/Bun environment only if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) { config.region = config.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION; + // Support proxies that don't need authentication + if (process.env.AWS_BEDROCK_SKIP_AUTH === "1") { + config.credentials = { + accessKeyId: "dummy-access-key", + secretAccessKey: "dummy-secret-key", + }; + } + if ( process.env.HTTP_PROXY || process.env.HTTPS_PROXY || diff --git a/packages/coding-agent/docs/providers.md b/packages/coding-agent/docs/providers.md index 44fbecd0..876d2993 100644 --- a/packages/coding-agent/docs/providers.md +++ b/packages/coding-agent/docs/providers.md @@ -140,17 +140,16 @@ Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_ pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0 ``` -If you are connecting to a bedrock API proxy, the following environment variables can be used -instead: +If you are connecting to a Bedrock API proxy, the following environment variables can be used: ```bash -# Set the URL for the bedrock proxy -export AWS_ENDPOINT_URL_BEDROCK_RUNTIME +# Set the URL for the Bedrock proxy (standard AWS SDK env var) +export AWS_ENDPOINT_URL_BEDROCK_RUNTIME=https://my.corp.proxy/bedrock # Set if your proxy does not require authentication export AWS_BEDROCK_SKIP_AUTH=1 -# Set if your proxy only supports HTTP 1.1 +# Set if your proxy only supports HTTP/1.1 export AWS_BEDROCK_FORCE_HTTP1=1 ```