About this project
openai-shim is a lightweight, no-dependency Python library designed to unify access to multiple LLM providers by translating their APIs into the OpenAI chat completion format. It supports failover across providers like Anthropic, Ollama, and custom endpoints — automatically switching if one fails due to rate limits, errors, or empty responses. The library handles differences in API structure (e.g., missing roles, token counting, streaming behavior) so your code doesn’t need to adapt. You can define custom adapters for any endpoint — even plain-text HTTP services — and route requests through a prioritized list of providers. It also includes built-in support for streaming, token estimation, model retirement tracking, and vision/tool capability filtering. Ideal for building resilient multi-provider gateways or proxying LLM calls without rewriting client logic. Written in pure standard library Python, it’s tested extensively with mock transports and suitable for production use.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.