Skip to main content

Crate llmshim

Crate llmshim 

Source

Re-exports§

pub use fallback::completion_with_fallback;
pub use fallback::completion_with_fallback_and_policy;
pub use fallback::FallbackConfig;
pub use llmshim_catalog as catalog;

Modules§

breaker
Provider circuit breaking.
cache
Caller-owned stability annotations, provider-owned placement mechanics.
client
config
Configuration file management for llmshim.
cost
USD cost accounting for a completed response.
credentials
Where a provider key comes from when the process environment does not carry one.
env
Shared environment/config loading.
error
fallback
log
models
Curated, verified discovery. Dynamic metadata lives in crate::catalog. Unverified facts stay Support::Unknown / None; never guess a number.
policy
Trusted, out-of-band policy hooks for individual provider attempts.
provider
providers
reasoning
Typed, lossless reasoning and a single fail-closed replay policy. Opaque data is never inspected to decide where a block may be sent.
router
schema
One schema walker with per-transport policy. External references are never fetched; unresolved/cyclic schemas fall back per tool rather than per request.
shim
Capability-based request plans. Internal protocols are decoded and validated before a response, stream event, or log entry can reach the caller.
streaming
Per-response stream normalization, shared by HTTP dispatch and manual SSE consumers. Tool arguments, ids and signatures are assembled before exposure.
toolcall
Owned tool-call identities, persisted wire mappings, and conversation checks.
usage
Shared cache accounting. Native counters are read once at the transport boundary; consumers never need to recognize a provider’s usage dialect.
vision
Vision/image content block translation between providers.

Statics§

SHARED_CLIENT
Shared HTTP client — reuses connection pool across all requests. Shared HTTP client with connection pooling.

Functions§

completion
Top-level entry point. Resolves the provider from the model string and fires the request.
completion_with_logger
Completion with optional logging.
completion_with_logger_and_policy
completion_with_policy
stream
Streaming entry point. Returns an SSE stream of OpenAI-format chunks.
stream_with_policy
warmup
Pre-establish TCP+TLS connections to all configured provider endpoints. Call once after creating the Router to eliminate cold-start latency on first request.