infomaniak-ai-provider
Version:
The Infomaniak provider for the [AI SDK](https://ai-sdk.dev/docs/introduction) contains language model support for the [Infomaniak AI Tools API](https://www.infomaniak.com/en/hosting/ai-services/open-source-models).
93 lines (89 loc) • 5.22 kB
TypeScript
import { OpenAICompatibleProviderSettings } from '@ai-sdk/openai-compatible';
import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3 } from '@ai-sdk/provider';
type ModelType = 'stt' | 'image' | 'embedding' | 'reranker' | 'llm';
type InfoStatus = 'ready' | 'coming_soon' | (string & {});
type InfomaniakSTTModelId = 'whisper' | (string & {});
type InfomaniakImageModelId = 'photomaker' | 'flux' | (string & {});
type InfomaniakEmbeddingModelId = 'bge_multilingual_gemma2' | 'mini_lm_l12_v2' | 'Qwen/Qwen3-Embedding-8B' | (string & {});
type InfomaniakRERANKERModelId = 'BAAI/bge-reranker-v2-m3' | 'Qwen/Qwen3-Reranker-0.6B' | (string & {});
type InfomaniakChatModelId = 'mistralai/Ministral-3-14B-Instruct-2512' | 'Qwen/Qwen3.5-122B-A10B-FP8' | 'google/gemma-4-31B-it' | 'moonshotai/Kimi-K2.6' | 'nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8' | 'mistralai/Mistral-Small-4-119B-2603' | 'Qwen/Qwen3.5-397B-A17B-FP8' | 'swiss-ai/Apertus-v1.5-70B' | (string & {});
type InfomaniakModelId = InfomaniakSTTModelId | InfomaniakImageModelId | InfomaniakEmbeddingModelId | InfomaniakRERANKERModelId | InfomaniakChatModelId;
interface InfomaniakModel {
description: string;
documentation_link: string;
id: number;
info_status: InfoStatus;
last_updated_at: string;
logo_url: string;
max_token_input: number | null;
name: string;
type: ModelType;
version: string | null;
}
type InfomaniakModels = InfomaniakModel[];
declare const MODEL_NAMES: {
readonly WHISPER: "whisper";
readonly PHOTOMAKER: "photomaker";
readonly FLUX: "flux";
readonly BGE_MULTILINGUAL_GEMMA2: "bge_multilingual_gemma2";
readonly MINI_LM_L12_V2: "mini_lm_l12_v2";
readonly 'QWEN/QWEN3-EMBEDDING-8B': "Qwen/Qwen3-Embedding-8B";
readonly 'BAAI/BGE-RERANKER-V2-M3': "BAAI/bge-reranker-v2-m3";
readonly 'QWEN/QWEN3-RERANKER-0.6B': "Qwen/Qwen3-Reranker-0.6B";
readonly 'MISTRALAI/MINISTRAL-3-14B-INSTRUCT-2512': "mistralai/Ministral-3-14B-Instruct-2512";
readonly 'QWEN/QWEN3.5-122B-A10B-FP8': "Qwen/Qwen3.5-122B-A10B-FP8";
readonly 'GOOGLE/GEMMA-4-31B-IT': "google/gemma-4-31B-it";
readonly 'MOONSHOTAI/KIMI-K2.6': "moonshotai/Kimi-K2.6";
readonly 'NVIDIA/NVIDIA-NEMOTRON-3-NANO-30B-A3B-FP8': "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8";
readonly 'MISTRALAI/MISTRAL-SMALL-4-119B-2603': "mistralai/Mistral-Small-4-119B-2603";
readonly 'QWEN/QWEN3.5-397B-A17B-FP8': "Qwen/Qwen3.5-397B-A17B-FP8";
readonly 'SWISS-AI/APERTUS-V1.5-70B': "swiss-ai/Apertus-v1.5-70B";
};
declare function getModelsByType<T extends ModelType>(models: InfomaniakModels, type: T): InfomaniakModel[];
declare function getReadyModels(models: InfomaniakModels): InfomaniakModels;
declare function getSTTModels(models: InfomaniakModels): InfomaniakModels;
declare function getImageModels(models: InfomaniakModels): InfomaniakModels;
declare function getEmbeddingModels(models: InfomaniakModels): InfomaniakModels;
declare function getRERANKERModels(models: InfomaniakModels): InfomaniakModels;
declare function getChatModels(models: InfomaniakModels): InfomaniakModels;
interface InfomaniakProviderSettings {
/**
API key for authenticating requests. If specified, adds an `Authorization`
header to request headers with the value `Bearer <apiKey>`. This will be added
before any headers potentially specified in the `headers` option. Defaults to
`INFOMANIAK_API_KEY` env variable
*/
apiKey?: OpenAICompatibleProviderSettings['apiKey'];
/**
Custom headers to include in the requests.
*/
headers?: OpenAICompatibleProviderSettings['headers'];
/**
Infomaniak product ID.
*/
productId?: string;
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: OpenAICompatibleProviderSettings['fetch'];
/**
Include usage information in streaming responses.
*/
includeUsage?: OpenAICompatibleProviderSettings['includeUsage'];
}
interface InfomaniakProvider {
(modelId: InfomaniakChatModelId): LanguageModelV3;
languageModel: (modelId: InfomaniakChatModelId) => LanguageModelV3;
chatModel: (modelId: InfomaniakChatModelId) => LanguageModelV3;
textEmbeddingModel: (modelId: InfomaniakEmbeddingModelId) => EmbeddingModelV3;
imageModel: (modelId: InfomaniakImageModelId) => ImageModelV3;
/**
* Creates a model for transcription.
* @experimental
*/
transcription: (modelId: InfomaniakSTTModelId) => TranscriptionModelV3;
}
declare function createInfomaniak(options?: InfomaniakProviderSettings): InfomaniakProvider;
declare const infomaniak: InfomaniakProvider;
export { type InfoStatus, type InfomaniakChatModelId, type InfomaniakEmbeddingModelId, type InfomaniakImageModelId, type InfomaniakModel, type InfomaniakModelId, type InfomaniakModels, type InfomaniakProvider, type InfomaniakProviderSettings, type InfomaniakRERANKERModelId, type InfomaniakSTTModelId, MODEL_NAMES, type ModelType, createInfomaniak, getChatModels, getEmbeddingModels, getImageModels, getModelsByType, getRERANKERModels, getReadyModels, getSTTModels, infomaniak };