jeremychone/rust-genai
Rust multiprovider generative AI client (Ollama, OpenAi, Anthropic, Gemini, DeepSeek, xAI/Grok, Groq,Cohere, ...)
What it solves
genai is a Rust library that provides a single, ergonomic API to access multiple AI providers (such as OpenAI, Anthropic, Gemini, and Ollama) without requiring the official SDKs for each service. It standardizes chat completions, vision, and function calling across different providers while allowing developers to use native protocols for better feature support.
How it works
The library uses an adapter-based architecture to map a common Rust API to the specific protocols of various AI providers. It can automatically resolve which provider to use based on the model name (e.g., gpt- for OpenAI, claude- for Anthropic) or allow developers to force a specific adapter using a namespaced syntax (e.g., groq::model-name). It supports native protocols when available and falls back to OpenAI-compatible APIs for others.
Who it’s for
Rust developers who want to integrate multiple LLM providers into their applications without managing multiple disparate SDKs or being locked into a single provider's API.
Highlights
- Extensive Provider Support: Out-of-the-box support for over 26 providers, including local execution via Ollama.
- Native Protocol Implementation: Uses native protocols instead of SDKs to better support features like reasoning controls and streaming metadata.
- Flexible Model Resolution: Supports automatic model-to-adapter mapping and custom target resolvers for specific endpoints and authentication.
- Multimodal Capabilities: Includes support for image analysis for providers like OpenAI, Gemini, and Anthropic.
- Advanced Controls: Provides provider-neutral tool selection hints and prompt cache controls for OpenAI and Anthropic.
Related
- Project
- Project
- Project
- Project
- Project