getApiKeyFromEnv -> getEnvApiKey

This commit is contained in:
Mario Zechner 2025-12-25 02:38:00 +01:00
parent bf022d2581
commit 9f97f0c8da
8 changed files with 16 additions and 53 deletions

View file

@ -5,7 +5,7 @@ import type {
MessageParam,
} from "@anthropic-ai/sdk/resources/messages.js";
import { calculateCost } from "../models.js";
import { getApiKeyFromEnv } from "../stream.js";
import { getEnvApiKey } from "../stream.js";
import type {
Api,
AssistantMessage,
@ -114,7 +114,7 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
};
try {
const apiKey = options?.apiKey ?? getApiKeyFromEnv(model.provider) ?? "";
const apiKey = options?.apiKey ?? getEnvApiKey(model.provider) ?? "";
const { client, isOAuthToken } = createClient(model, apiKey, options?.interleavedThinking ?? true);
const params = buildParams(model, context, isOAuthToken, options);
const anthropicStream = client.messages.stream({ ...params, stream: true }, { signal: options?.signal });