@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
61 lines (60 loc) • 2.21 kB
TypeScript
import { type LanguageModel, type Schema } from "ai";
import type { ZodType } from "zod";
import { AIProviderName } from "../constants/enums.js";
import { BaseProvider } from "../core/baseProvider.js";
import type { StreamOptions, StreamResult } from "../types/index.js";
/**
* OpenRouter Provider - BaseProvider Implementation
* Provides access to 300+ models from 60+ providers via OpenRouter unified gateway
*/
export declare class OpenRouterProvider extends BaseProvider {
private model;
private openRouterClient;
private config;
private static modelsCache;
private static modelsCacheTime;
private static readonly MODELS_CACHE_DURATION;
private static toolCapableModels;
private static capabilitiesCached;
constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: {
apiKey?: string;
baseURL?: string;
});
protected getProviderName(): AIProviderName;
protected getDefaultModel(): string;
/**
* Returns the Vercel AI SDK model instance for OpenRouter
*/
protected getAISDKModel(): LanguageModel;
formatProviderError(error: unknown): Error;
/**
* OpenRouter supports tools for compatible models
* Checks cached model capabilities or uses known patterns as fallback
*/
supportsTools(): boolean;
/**
* Provider-specific streaming implementation
* Note: This is only used when tools are disabled
*/
protected executeStream(options: StreamOptions, analysisSchema?: ZodType | Schema<unknown>): Promise<StreamResult>;
/**
* Get available models from OpenRouter API
* Dynamically fetches from /api/v1/models endpoint with caching and fallback
*/
getAvailableModels(): Promise<string[]>;
/**
* Fetch available models from OpenRouter API /api/v1/models endpoint
* @private
*/
private fetchModelsFromAPI;
/**
* Type guard to validate the models API response structure
* @private
*/
private isValidModelsResponse;
/**
* Fetch and cache model capabilities from OpenRouter API
* Call this to enable accurate tool support detection
*/
cacheModelCapabilities(): Promise<void>;
}