diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index d0f23fc2..a0d5d791 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed bug where `ANTHROPIC_API_KEY` environment variable was deleted globally after first OAuth token usage, causing subsequent prompts to fail + ## [0.17.0] - 2025-12-09 ### Added diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts index ff6e60e2..a1791b8a 100644 --- a/packages/ai/src/providers/anthropic.ts +++ b/packages/ai/src/providers/anthropic.ts @@ -289,11 +289,6 @@ function createClient( ...(model.headers || {}), }; - // Clear the env var if we're in Node.js to prevent SDK from using it - if (typeof process !== "undefined" && process.env) { - delete process.env.ANTHROPIC_API_KEY; - } - const client = new Anthropic({ apiKey: null, authToken: apiKey,