API reference
AnyLLM class
Create reusable provider clients and inspect the provider registry.
Creation
const llm = AnyLLM.create(provider, options);
const llm = AnyLLM.fromProvider(adapter);
const llm = AnyLLM.createOpenAICompatible(options);AnyLLM.create() resolves a registered provider. fromProvider() wraps an already constructed
adapter. createOpenAICompatible() creates an isolated OpenAI-compatible client without modifying
the registry.
Instance properties
| Property | Type | Description |
|---|---|---|
provider | string | Normalized provider name. |
metadata | ProviderMetadata | Configuration and conservative capability flags. |
Instance operations
llm.completion(params)
llm.responses(params)
llm.embedding(params)
llm.listModels(providerOptions?)
llm.imageGeneration(params)
llm.transcription(params)
llm.speech(params)
llm.moderation(params)
llm.messages(params)
llm.rerank(params)
llm.createBatch(params)
llm.retrieveBatch(batchId, providerOptions?)
llm.cancelBatch(batchId, providerOptions?)
llm.listBatches(params?)
llm.retrieveBatchResults(batchId, providerOptions?)
llm.uploadFile(params)
llm.listFiles(params?)
llm.retrieveFile(params)
llm.downloadFile(params)
llm.deleteFile(params)messages() uses native Messages support where available and translates through normalized chat
completions for compatible providers. Operations that an adapter does not support reject with
UnsupportedOperationError.
Registry methods
AnyLLM.getSupportedProviders();
AnyLLM.getProviderMetadata("openai");
AnyLLM.getAllProviderMetadata();Model parsing
AnyLLM.splitModelProvider("anthropic:claude-sonnet-4-5");
// { provider: "anthropic", model: "claude-sonnet-4-5" }The method throws InvalidModelSyntaxError when no provider can be determined.
Declaration
The table below is generated from src/any-llm.ts.
Prop
Type