fix: support Bedrock API key login

This commit is contained in:
Armin Ronacher
2026-07-10 19:34:11 +02:00
parent 91585d9a38
commit 3ea064ea2a
10 changed files with 72 additions and 36 deletions
+5 -1
View File
@@ -9,7 +9,11 @@ import { AMAZON_BEDROCK_MODELS } from "./amazon-bedrock.models.ts";
* configured. A stored credential key is surfaced as the bearer token.
*/
const bedrockAuth: ApiKeyAuth = {
name: "AWS credentials",
name: "Bedrock API key or AWS credentials",
login: async (callbacks) => ({
type: "api_key",
key: await callbacks.prompt({ type: "secret", message: "Enter Bedrock API key" }),
}),
resolve: async ({ ctx, credential }) => {
if (credential?.key) return { auth: { apiKey: credential.key }, source: "stored credential" };
if (await ctx.env("AWS_BEARER_TOKEN_BEDROCK")) return { auth: {}, source: "AWS_BEARER_TOKEN_BEDROCK" };