Skip to main content

Crate cairn_models

Crate cairn_models 

Source
Expand description

Model adapters for Cairn.

  • AnthropicModel speaks the Messages API natively and preserves extended thinking and prompt caching.
  • OpenAiCompatModel speaks Chat Completions, which covers OpenAI, Google Gemini (OpenAI-compatible endpoint), Ollama, vLLM, OpenRouter, Groq, Together and most self-hosted servers.

Structs§

AnthropicModel
Native Anthropic Messages API adapter.
OpenAiCompatModel
Chat Completions adapter for any OpenAI-compatible endpoint.
Priced
Attaches pricing to any model, e.g. one built from a provider:model spec.
Pricing
USD per million tokens. Prices change often, so Cairn never hardcodes them; set them from your provider’s current price sheet. A model that is genuinely free should say so explicitly with Pricing::new(0.0, 0.0).

Functions§

from_spec
Build a model from a provider:model spec, reading credentials from the environment.