Expand description
Model adapters for Cairn.
AnthropicModelspeaks the Messages API natively and preserves extended thinking and prompt caching.OpenAiCompatModelspeaks Chat Completions, which covers OpenAI, Google Gemini (OpenAI-compatible endpoint), Ollama, vLLM, OpenRouter, Groq, Together and most self-hosted servers.
Structs§
- Anthropic
Model - Native Anthropic Messages API adapter.
- Open
AiCompat Model - Chat Completions adapter for any OpenAI-compatible endpoint.
- Priced
- Attaches pricing to any model, e.g. one built from a
provider:modelspec. - 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:modelspec, reading credentials from the environment.