UNPKG

aiwrapper

Version:

A Universal AI Wrapper for JavaScript & TypeScript

44 lines (43 loc) 1.53 kB
var __defProp = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; import { OpenAIChatCompletionsLang } from "../openai/openai-chat-completions-lang.js"; class OpenRouterLang extends OpenAIChatCompletionsLang { constructor(options) { const modelName = options.model || "openai/gpt-5-mini"; const headers = __spreadValues({}, options.headers); if (options.siteUrl) { headers["HTTP-Referer"] = options.siteUrl; } if (options.siteName) { headers["X-Title"] = options.siteName; } super({ apiKey: options.apiKey, model: modelName, systemPrompt: options.systemPrompt || "", maxTokens: options.maxTokens, maxCompletionTokens: options.maxCompletionTokens, baseURL: "https://openrouter.ai/api/v1", headers, bodyProperties: options.bodyProperties }); } } export { OpenRouterLang }; //# sourceMappingURL=openrouter-lang.js.map