@ai-ml.api/aimlapi-vercel-ai
Version:
AI SDK provider for AI/ML API: 300+ models via OpenAI-compatible API.
30 lines (26 loc) • 1.42 kB
TypeScript
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2 } from '@ai-sdk/provider';
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
type AIMLAPIImageModelId = 'dall-e-2' | 'dall-e-3' | 'flux-pro' | 'flux-pro/v1.1' | 'flux-pro/v1.1-ultra' | 'flux-realism' | 'google/imagen4/preview' | 'imagen-3.0-generate-002' | 'recraft-v3' | 'stable-diffusion-v3-medium' | 'stable-diffusion-v35-large' | 'triposr' | (string & {});
interface AimlapiImageSettings {
/**
* Override the maximum number of images per call (default 1)
*/
maxImagesPerCall?: number;
}
interface AIMLAPIProviderSettings {
apiKey?: string;
baseURL?: string;
headers?: Resolvable<Record<string, string | undefined>>;
fetch?: FetchFunction;
}
interface AIMLAPIProvider extends ProviderV2 {
(modelId: string): LanguageModelV2;
chat(modelId: string): LanguageModelV2;
completion(modelId: string): LanguageModelV2;
languageModel(modelId: string): LanguageModelV2;
textEmbeddingModel(modelId: string): EmbeddingModelV2<string>;
imageModel(modelId: string, settings?: AimlapiImageSettings): ImageModelV2;
}
declare function createAIMLAPI(options?: AIMLAPIProviderSettings): AIMLAPIProvider;
declare const aimlapi: AIMLAPIProvider;
export { type AIMLAPIImageModelId, type AIMLAPIProvider, type AIMLAPIProviderSettings, type AimlapiImageSettings, aimlapi, createAIMLAPI };