import { ModelSettings } from "../validation/schemas.js"; import { LanguageModel } from "ai"; import { JSONObject } from "@ai-sdk/provider"; //#region src/utils/model-factory.d.ts /** * Factory for creating AI SDK language models from configuration * Supports multiple providers and AI Gateway integration */ declare class ModelFactory { /** * Create a provider instance with custom configuration * Returns a provider with at least languageModel method */ private static createProvider; /** * Extract provider configuration from providerOptions * Only includes settings that go to the provider constructor (baseURL, headers, etc.) */ private static extractProviderConfig; /** * Extract per-call provider options to pass as providerOptions in streamText/generateText. * Any object-valued key (except constructor config keys like headers) is treated as * a provider-specific per-call option, e.g. anthropic.thinking, gateway.models. */ static extractStreamProviderOptions(providerOptions?: Record): Record | undefined; /** * Whether the given model settings will route through the Vercel AI Gateway * vs. instantiating a direct provider client. Mirrors the gate used inside * createModel so callers (e.g. the prompt-caching actuator) can detect mode * without recreating the model instance. */ static shouldRouteViaGateway(modelSettings: ModelSettings): boolean; /** * Create a language model instance from configuration * Throws error if no config provided - models must be configured at project level */ static createModel(config: ModelSettings): LanguageModel; /** * Built-in providers that have special handling */ private static readonly BUILT_IN_PROVIDERS; /** * Parse model string to extract provider and model name * Examples: "anthropic/claude-sonnet-4" -> { provider: "anthropic", modelName: "claude-sonnet-4" } * "openrouter/anthropic/claude-sonnet-4" -> { provider: "openrouter", modelName: "anthropic/claude-sonnet-4" } * "claude-sonnet-4" -> { provider: "anthropic", modelName: "claude-sonnet-4" } (default to anthropic) */ static parseModelString(modelString: string): { provider: string; modelName: string; }; /** * Get generation parameters from provider options * These are parameters that get passed to generateText/streamText calls */ static getGenerationParams(providerOptions?: Record): Record; /** * Prepare complete generation configuration from model settings * Returns model instance and generation parameters ready to spread into generateText/streamText * Includes maxDuration if specified in provider options (in seconds, following Vercel standard) */ static prepareGenerationConfig(modelSettings?: ModelSettings): { model: LanguageModel; maxDuration?: number; providerOptions?: Record; }; /** * Validate model settingsuration * Basic validation only - let AI SDK handle parameter-specific validation */ static validateConfig(config: ModelSettings): string[]; } //#endregion export { ModelFactory };