cognis-llm defines the LLMProvider trait and ships clients for the major vendors. It also defines the Tool trait that the agent layer dispatches.
Crate metadata
Modules at a glance
Key types
Client
Client implements Runnable<Vec<Message>, Message> — wrap with RunnableExt methods for retry / timeout / fallback / cache.
ClientBuilder
LLMProvider
Provider builders
Each lives undercognis_llm::provider::* and returns a value that’s wrapped into a Client via Client::new(Arc::new(provider)).
openai::OpenAIBuilder—api_key,base_url,model,timeout_secs,organization.anthropic::AnthropicBuilder—api_key,base_url,model,timeout_secs.google::GoogleBuilder—api_key,base_url,model,timeout_secs.ollama::OllamaBuilder—base_url,model,timeout_secs.azure::AzureBuilder—endpoint,deployment,api_version,api_key,timeout_secs.openrouter::OpenRouterBuilder—api_key,model,extra_header(name, value).
Tool trait
SchemaBasedTool is a convenience layer: declare type Params: JsonSchema, implement execute_typed, get a Tool impl free.
ToolRegistry
ToolRegistry internally; you usually don’t construct one directly.
Feature flags
See also
Models and providers
User-facing guide for Client and the provider builders.
Tools
Defining tools with
Tool and SchemaBasedTool.