@nomyx/assistant
Version:
A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)
46 lines (45 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenRouterConfig = void 0;
const modelConfig_1 = require("./modelConfig");
class OpenRouterConfig {
constructor(config, logger) {
this.config = config;
this.logger = logger;
}
get apiKey() {
return this.config.apiKey;
}
get model() {
return this.config.model || modelConfig_1.DEFAULT_OPENROUTER_MODEL;
}
get baseUrl() {
return this.config.baseUrl || 'https://openrouter.ai/api/v1';
}
get httpReferer() {
return this.config.httpReferer;
}
get xTitle() {
return this.config.xTitle;
}
getApiUrl(endpoint) {
return `${this.baseUrl}/${endpoint}`;
}
getHeaders() {
const headers = {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
};
if (this.httpReferer) {
headers['HTTP-Referer'] = this.httpReferer;
}
if (this.xTitle) {
headers['X-Title'] = this.xTitle;
}
return headers;
}
getLogger() {
return this.logger;
}
}
exports.OpenRouterConfig = OpenRouterConfig;