Add 'pi' command alias and fix getApiKey import

This commit is contained in:
Mario Zechner 2025-11-12 14:31:25 +01:00
parent 00d8286523
commit bf1a7d8571
4 changed files with 284 additions and 8 deletions

View file

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