Anthropic Provider
Public exports from @anvia/anthropic.
Import from @anvia/anthropic.
AnthropicClient
type AnthropicClientOptions = {
apiKey?: string;
baseUrl?: string;
client?: Anthropic;
};
class AnthropicClient {
readonly client: Anthropic;
constructor(options?: AnthropicClientOptions);
listModels(): Promise<ModelList>;
completionModel(model?: string): AnthropicCompletionModel;
}Purpose: factory for Anthropic completion models and model listing.
Return behavior: completionModel(...) returns a streaming Anvia completion model. listModels() fetches Anthropic's model list and returns a normalized ModelList.
Notable errors: constructor throws when neither client nor apiKey is supplied; listModels() rejects with ModelListingError when the provider request fails.
AnthropicCompletionModel
class AnthropicCompletionModel implements StreamingCompletionModel {
constructor(client: Anthropic, defaultModel?: string);
completion(request: CompletionRequest): Promise<CompletionResponse>;
streamCompletion(request: CompletionRequest): AsyncIterable<CompletionStreamEvent>;
}Purpose: adapter for Anthropic Messages API.
Return behavior: maps Anvia completion requests to Anthropic params and returns normalized responses/events.
Notable errors: rejects or yields SDK/provider errors.
Helper Namespaces
namespace anthropic {
AnthropicClient;
AnthropicCompletionModel;
}Purpose: namespaced access to the same public model/client exports.
Return behavior: export namespaces only.
Notable errors: none directly.
