// OpenRouter Provider — OpenAI-compatible chat completions

import { OpenAICompatibleProvider } from './openai-compatible.mjs';

export class OpenRouterProvider extends OpenAICompatibleProvider {
  constructor(config) {
    super({
      ...config,
      name: 'openrouter',
      baseUrl: config.baseUrl || 'https://openrouter.ai/api/v1',
      model: config.model || 'openrouter/free',
      extraHeaders: {
        'HTTP-Referer': 'https://github.com/calesthio/Crucix',
        'X-Title': 'Crucix',
        ...(config.openRouterSiteUrl ? { 'HTTP-Referer': config.openRouterSiteUrl } : {}),
        ...(config.openRouterAppName ? { 'X-Title': config.openRouterAppName } : {}),
      },
    });
  }
}
