Skip to main content
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

Implement this for custom backends — internal gateways, mock providers in tests, self-hosted runtimes.

Provider builders

Each lives under cognis_llm::provider::* and returns a value that’s wrapped into a Client via Client::new(Arc::new(provider)).
  • openai::OpenAIBuilderapi_key, base_url, model, timeout_secs, organization.
  • anthropic::AnthropicBuilderapi_key, base_url, model, timeout_secs.
  • google::GoogleBuilderapi_key, base_url, model, timeout_secs.
  • ollama::OllamaBuilderbase_url, model, timeout_secs.
  • azure::AzureBuilderendpoint, deployment, api_version, api_key, timeout_secs.
  • openrouter::OpenRouterBuilderapi_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

The agent’s tool dispatcher uses a 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.