Skip to main content

Crate tokenmiser_providers

Crate tokenmiser_providers 

Source
Expand description

Upstream provider clients, normalized to the OpenAI chat/completions wire shape in both directions. Provider is the single seam: proxy code never branches on provider kind.

Re-exports§

pub use registry::ProviderRegistry;

Modules§

anthropic
Anthropic Messages API client. Translates OpenAI-shaped requests/responses at the wire boundary so the rest of the gateway stays OpenAI-canonical.
ollama
Ollama client — uses the OpenAI-compatible endpoint Ollama exposes on /v1/chat/completions, so this is essentially the OpenAI client with no auth header and a localhost base URL.
openai
OpenAI client (also covers DeepSeek, Cerebras, DeepInfra — anything that speaks OpenAI’s /v1/chat/completions wire shape).
registry
Resolves a model name to a concrete Provider, in order: configured alias, provider:model prefix, model-family heuristic, then the opt-in routing.default_provider.

Structs§

ChatChoice
ChatMessage
ChatRequest
Canonical OpenAI-shaped chat completion request.
ChatResponse
Canonical OpenAI-shaped chat completion response.
Usage

Enums§

ProviderError
StreamChunk
A single SSE event from an upstream provider, passed to the client as-is.

Traits§

Provider

Functions§

response_visible_content_empty
True when the visible message.content is empty or whitespace. Reasoning-mode models can emit every token into a reasoning field and leave content blank, which is a broken response to the caller.