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

@ -1966,8 +1966,8 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
input: 0.255,
output: 1.02,
input: 0.21,
output: 0.84,
cacheRead: 0,
cacheWrite: 0,
},
@ -2238,13 +2238,13 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
input: 0.44999999999999996,
output: 1.9,
input: 0.6,
output: 2.2,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 202752,
maxTokens: 4096,
contextWindow: 204800,
maxTokens: 131072,
} satisfies Model<"openai-completions">,
"anthropic/claude-sonnet-4.5": {
id: "anthropic/claude-sonnet-4.5",

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 });