diff options
| author | polwex <polwex@sortug.com> | 2025-07-23 05:41:58 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-07-23 05:41:58 +0700 |
| commit | 9766782648617e232fbc4e40ea96a0e567c7cc73 (patch) | |
| tree | 084943c250a0ad6d7a3227a6b10b237ee07b2388 /index.ts | |
| parent | 42dd99bfac9777a4ecc6700b87edf26a5c984de6 (diff) | |
something like that. man anthropic is old
Diffstat (limited to 'index.ts')
| -rw-r--r-- | index.ts | 75 |
1 files changed, 54 insertions, 21 deletions
@@ -2,35 +2,68 @@ import Claude from "./src/claude"; import Gemini from "./src/gemini"; import Generic from "./src/generic"; -import type { AIModelAPI, AIModelChoice } from "./src/types"; +import type { AIModelAPI, LLMChoice } from "./src/types"; export type * from "./src/types"; export * as NLP from "./src/nlp"; -export default function (choice: AIModelChoice): AIModelAPI { +export default function (choice: LLMChoice): AIModelAPI { const api = - "other" in choice - ? new Generic(choice.other) - : choice.name === "deepseek" - ? new Generic({ - baseURL: "https://api.deepseek.com", - apiKey: Bun.env.DEEPSEEK_API_KEY!, - model: "deepseek-chat", - }) - : choice.name === "grok" + "gemini" in choice + ? new Gemini(choice.gemini) + : "claude" in choice + ? new Claude(choice.claude) + : "chatgpt" in choice ? new Generic({ - baseURL: "https://api.x.ai/v1", - apiKey: Bun.env.GROK_API_KEY!, - model: "grok-2-latest", + baseURL: "https://api.openai.com/v1", + apiKey: Bun.env.OPENAI_API_KEY!, + model: choice.chatgpt || "o4-mini", }) - : choice.name === "chatgpt" + : "deepseek" in choice ? new Generic({ - baseURL: "https://api.openai.com/v1", - apiKey: Bun.env.OPENAI_API_KEY!, - model: "gpt-4o", + baseURL: "https://api.deepseek.com", + apiKey: Bun.env.DEEPSEEK_API_KEY!, + model: "deepseek-reasoner", }) - : choice.name === "claude" - ? new Claude() - : new Gemini(); + : "kimi" in choice + ? new Generic({ + baseURL: "https://api.moonshot.ai/v1", + apiKey: Bun.env.MOONSHOT_API_KEY!, + model: "kimi-k2-0711-preview", // "kimi-latest"? + }) + : "grok" in choice + ? new Generic({ + baseURL: "https://api.x.ai/v1", + apiKey: Bun.env.XAI_API_KEY!, + model: "grok-4", // "kimi-latest"? + }) + : new Generic({ + baseURL: choice.openai.url, + apiKey: choice.openai.apiKey, + model: choice.openai.model, + }); + // "" in choice + // ? new Generic(choice.other) + // : choice.name === "deepseek" + // ? new Generic({ + // baseURL: "https://api.deepseek.com", + // apiKey: Bun.env.DEEPSEEK_API_KEY!, + // model: "deepseek-chat", + // }) + // : choice.name === "grok" + // ? new Generic({ + // baseURL: "https://api.x.ai/v1", + // apiKey: Bun.env.GROK_API_KEY!, + // model: "grok-2-latest", + // }) + // : choice.name === "chatgpt" + // ? new Generic({ + // baseURL: "https://api.openai.com/v1", + // apiKey: Bun.env.OPENAI_API_KEY!, + // model: "gpt-4o", + // }) + // : choice.name === "claude" + // ? new Claude() + // : new Gemini(); return api; } |
