Documentation Index
Fetch the complete documentation index at: https://cognis.vasanth.xyz/llms.txt
Use this file to discover all available pages before exploring further.
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
| Field | Value |
|---|---|
| Latest version | 0.3 |
| docs.rs | docs.rs/cognis-llm |
| Repo path | crates/cognis-llm |
| Default features | openai, ollama |
Modules at a glance
| Module | What |
|---|---|
client | Client, ClientBuilder. The provider-agnostic surface. |
provider | LLMProvider trait, Provider enum, plus per-vendor builders (openai::OpenAIBuilder, anthropic::AnthropicBuilder, etc.). |
chat | ChatOptions, ChatResponse, Usage, StreamChunk, HealthStatus. |
streaming | Aggregated, StreamAggregator, UsageTracker. |
tools | Tool (alias BaseTool), SchemaBasedTool, ToolDefinition, ToolInput, ToolOutput, ToolRegistry. |
Key types
Client
Client implements Runnable<Vec<Message>, Message> — wrap with RunnableExt methods for retry / timeout / fallback / cache.
ClientBuilder
| Method | Purpose |
|---|---|
provider(Provider) | One of OpenAi, Anthropic, Google, Ollama, Azure, OpenRouter. |
api_key(String) | Provider key. |
base_url(String) | Override the API base. |
model(String) | Default model name. |
timeout_secs(u64) | HTTP timeout. |
organization(String) | OpenAI org id. |
azure_endpoint(String) / azure_deployment(String) / azure_api_version(String) | Azure-specific. |
build() | Result<Client>. |
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
| Feature | Pulls in |
|---|---|
openai | reqwest, secrecy, OpenAI client (default). |
anthropic | Anthropic Messages client. |
google | Gemini client. |
ollama | Ollama client (default). |
azure | Azure OpenAI client. |
all-providers | All of the above. |
See also
Models and providers
User-facing guide for Client and the provider builders.
Tools
Defining tools with
Tool and SchemaBasedTool.