/** * OpenRouter Provider Adapter * * Implements the unified ILLMProvider interface for OpenRouter's API. * OpenRouter provides an OpenAI-compatible chat completions API at * https://openrouter.ai/api/v1, with required HTTP-Referer and X-Title * headers for attribution. * * Models use provider-prefixed format (e.g., "anthropic/claude-sonnet-4", * "openai/gpt-4o", "google/gemini-2.0-flash"). The default model for * HoloScript generation is "anthropic/claude-sonnet-4" — a strong generalist * that balances cost and capability. * * @version 1.0.0 */ import { BaseLLMAdapter } from '../base-adapter'; import type { Capabilities, LLMCompletionRequest, LLMCompletionResponse, LLMRequestOptions, OpenRouterProviderConfig } from '../types'; export declare const OPENROUTER_MODELS: readonly ["anthropic/claude-haiku-4.5", "anthropic/claude-sonnet-4", "anthropic/claude-opus-4", "openai/gpt-4o", "openai/gpt-4o-mini", "google/gemini-2.0-flash-001", "meta-llama/llama-3.3-70b-instruct", "deepseek/deepseek-chat", "x-ai/grok-3", "x-ai/grok-3-mini"]; export type OpenRouterModel = (typeof OPENROUTER_MODELS)[number]; /** * OpenRouter provider adapter for HoloScript. * * OpenRouter routes to 200+ models through a single OpenAI-compatible API. * The required HTTP-Referer and X-Title headers are set for attribution; * callers can override via config. * * @example * ```typescript * const openrouter = new OpenRouterAdapter({ * apiKey: process.env.OPENROUTER_API_KEY!, * referer: 'https://myapp.com', * title: 'My App', * }); * * const scene = await openrouter.generateHoloScript({ * prompt: "a floating island with glowing crystals", * }); * console.log(scene.code); * ``` */ /** * Capability manifest — OpenRouter is a meta-provider whose actual * capabilities depend on the upstream model selected. Conservative * declaration: only what's universally true across the catalog. * * For routing decisions that need specific model superpowers, prefer * the direct provider adapter (Anthropic / OpenAI / etc.) — OpenRouter * is the fallback / cost-shopping path, not the capability-sensitive * default. `costPerMillion` omitted (varies wildly per upstream). * * Exported as a constant so the capability-aware router can read it * without instantiating the adapter — single source of truth per W.GOLD.006. */ export declare const OPENROUTER_CAPABILITIES: Capabilities; /** Build the OpenAI-compatible request sent to OpenRouter. */ export declare function buildOpenRouterChatCompletionPayload(request: LLMCompletionRequest, model: string): Record; export declare class OpenRouterAdapter extends BaseLLMAdapter { readonly name: "openrouter"; readonly models: readonly ["anthropic/claude-haiku-4.5", "anthropic/claude-sonnet-4", "anthropic/claude-opus-4", "openai/gpt-4o", "openai/gpt-4o-mini", "google/gemini-2.0-flash-001", "meta-llama/llama-3.3-70b-instruct", "deepseek/deepseek-chat", "x-ai/grok-3", "x-ai/grok-3-mini"]; readonly defaultHoloScriptModel: string; readonly capabilities: Capabilities; private readonly referer; private readonly title; constructor(config: OpenRouterProviderConfig); protected getDefaultModel(): string; complete(request: LLMCompletionRequest, model?: string, options?: LLMRequestOptions): Promise; private mapFinishReason; private mapOpenRouterError; }