diff --git a/docs/providers/bedrock.md b/docs/providers/bedrock.md index 23850a49ab52..d11eb1b125dc 100644 --- a/docs/providers/bedrock.md +++ b/docs/providers/bedrock.md @@ -38,6 +38,18 @@ Choose your preferred auth method and follow the setup steps. export AWS_BEARER_TOKEN_BEDROCK="..." ``` + + Claude Fable 5 and Claude Mythos-class Bedrock models require the Bedrock Data Retention API mode `provider_data_share` before invocation. This opt-in allows Bedrock to share prompts and completions with Anthropic and retain them for up to 30 days for trust and safety review. + + ```bash + curl -X PUT https://bedrock-mantle.us-east-1.api.aws/v1/data_retention \ + -H "x-api-key: $BEDROCK_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ "mode": "provider_data_share" }' + ``` + + Use another Bedrock model in the config if you cannot accept that retention mode. + No `apiKey` is required. Configure the provider with `auth: "aws-sdk"`: diff --git a/src/llm/providers/anthropic.test.ts b/src/llm/providers/anthropic.test.ts index 234e551ca5b0..05ec2f27ecec 100644 --- a/src/llm/providers/anthropic.test.ts +++ b/src/llm/providers/anthropic.test.ts @@ -87,6 +87,7 @@ describe("Anthropic provider", () => { const model = makeAnthropicModel({ provider: "microsoft-foundry", baseUrl: "https://example.services.ai.azure.com/anthropic", + authHeader: true, }); const context = { messages: [{ role: "user", content: "hello", timestamp: 1 }], @@ -108,6 +109,30 @@ describe("Anthropic provider", () => { expect(config.defaultHeaders?.["x-api-key"]).toBeUndefined(); }); + it("keeps Microsoft Foundry API-key profiles on Anthropic API key auth", async () => { + const model = makeAnthropicModel({ + provider: "microsoft-foundry", + baseUrl: "https://example.services.ai.azure.com/anthropic", + authHeader: false, + }); + const context = { + messages: [{ role: "user", content: "hello", timestamp: 1 }], + } satisfies Context; + + streamAnthropic(model, context, { + apiKey: "foundry-resource-key", + }); + + await vi.waitFor(() => expect(anthropicMockState.configs).toHaveLength(1)); + const config = anthropicMockState.configs[0] as { + apiKey?: string | null; + authToken?: string | null; + }; + + expect(config.apiKey).toBe("foundry-resource-key"); + expect(config.authToken).toBeNull(); + }); + it("preserves provider-signed Anthropic thinking and drops reasoning_content placeholders", async () => { const highSurrogate = String.fromCharCode(0xd83d); const signedThinking = `keep${highSurrogate}signed`; diff --git a/src/llm/providers/anthropic.ts b/src/llm/providers/anthropic.ts index a03a321a54b6..4f6fb964210b 100644 --- a/src/llm/providers/anthropic.ts +++ b/src/llm/providers/anthropic.ts @@ -945,7 +945,7 @@ function createClient( return { client, isOAuthToken: false }; } - if (model.provider === "microsoft-foundry") { + if (model.provider === "microsoft-foundry" && model.authHeader === true) { const client = new Anthropic({ apiKey: null, authToken: apiKey,