Esperanto
A unified interface for various AI model providers
Install / Use
/learn @lfnovo/EsperantoQuality Score
Category
Development & EngineeringSupported Platforms
README
Esperanto 🌐
Esperanto is a powerful Python library that provides a unified interface for interacting with various Large Language Model (LLM) providers. It simplifies the process of working with different AI models (LLMs, Embedders, Transcribers, and TTS) APIs by offering a consistent interface while maintaining provider-specific optimizations.
Why Esperanto? 🚀
🪶 Ultra-Lightweight Architecture
- Direct HTTP Communication: All providers communicate directly via HTTP APIs using
httpx- no bulky vendor SDKs required - Minimal Dependencies: Unlike LangChain and similar frameworks, Esperanto has a tiny footprint with zero overhead layers
- Production-Ready Performance: Direct API calls mean faster response times and lower memory usage
🔄 True Provider Flexibility
- Standardized Responses: Switch between any provider (OpenAI ↔ Anthropic ↔ Google ↔ etc.) without changing a single line of code
- Consistent Interface: Same methods, same response objects, same patterns across all 15+ providers
- Future-Proof: Add new providers or change existing ones without refactoring your application
⚡ Perfect for Production
- Prototyping to Production: Start experimenting and deploy the same code to production
- No Vendor Lock-in: Test different providers, optimize costs, and maintain flexibility
- Enterprise-Ready: Direct HTTP calls, standardized error handling, and comprehensive async support
Whether you're building a quick prototype or a production application serving millions of requests, Esperanto gives you the performance of direct API calls with the convenience of a unified interface.
Features ✨
- Unified Interface: Work with multiple LLM providers using a consistent API
- Provider Support:
- OpenAI (GPT-4o, o1, o3, o4, Whisper, TTS)
- OpenAI-Compatible (LM Studio, Ollama, vLLM, custom endpoints)
- Anthropic (Claude models)
- OpenRouter (Access to multiple models)
- xAI (Grok)
- Perplexity (Sonar models)
- Groq (Mixtral, Llama, Whisper)
- Google GenAI (Gemini LLM, Speech-to-Text, Text-to-Speech, Embedding with native task optimization)
- Vertex AI (Google Cloud, LLM, Embedding, TTS)
- Ollama (Local deployment multiple models)
- Transformers (Universal local models - Qwen, CrossEncoder, BAAI, Jina, Mixedbread)
- ElevenLabs (Text-to-Speech, Speech-to-Text)
- Azure OpenAI (Chat, Embedding, Whisper, TTS)
- Mistral (Mistral Large, Small, Embedding, etc.)
- DeepSeek (deepseek-chat)
- DashScope / Qwen (qwen-turbo, qwen-plus, qwen-max)
- MiniMax (MiniMax-M2.5)
- Voyage (Embeddings, Reranking)
- Jina (Advanced embedding models with task optimization, Reranking)
- Embedding Support: Multiple embedding providers for vector representations
- Reranking Support: Universal reranking interface for improving search relevance
- Speech-to-Text Support: Transcribe audio using multiple providers
- Text-to-Speech Support: Generate speech using multiple providers
- Async Support: Both synchronous and asynchronous API calls
- Streaming: Support for streaming responses
- Structured Output: JSON output formatting (where supported)
- LangChain Integration: Easy conversion to LangChain chat models
📚 Documentation
- Quick Start Guide - Get started in 5 minutes
- Documentation Index - Complete documentation hub
- Provider Comparison - Choose the right provider
- Configuration Guide - Environment setup
By Capability
- Language Models (LLM) - Text generation and chat
- Embeddings - Vector representations
- Reranking - Search relevance
- Speech-to-Text - Audio transcription
- Text-to-Speech - Voice generation
By Provider
- Provider Setup Guides - Complete setup for all 17 providers
Advanced Topics
- Task-Aware Embeddings
- LangChain Integration
- Timeout Configuration
- SSL Configuration
- Model Discovery
- Transformers Features
CHANGELOG - Version history and migration guides
Installation 🚀
Install Esperanto using pip:
pip install esperanto
Optional Dependencies
Transformers Provider
If you plan to use the transformers provider, install with the transformers extra:
pip install "esperanto[transformers]"
This installs:
transformers- Core Hugging Face librarytorch- PyTorch frameworktokenizers- Fast tokenizationsentence-transformers- CrossEncoder supportscikit-learn- Advanced embedding featuresnumpy- Numerical computations
LangChain Integration
If you plan to use any of the .to_langchain() methods, you need to install the correct LangChain SDKs manually:
# Core LangChain dependencies (required)
pip install "langchain>=0.3.8,<0.4.0" "langchain-core>=0.3.29,<0.4.0"
# Provider-specific LangChain packages (install only what you need)
pip install "langchain-openai>=0.2.9"
pip install "langchain-anthropic>=0.3.0"
pip install "langchain-google-genai>=2.1.2"
pip install "langchain-ollama>=0.2.0"
pip install "langchain-groq>=0.2.1"
pip install "langchain_mistralai>=0.2.1"
pip install "langchain_deepseek>=0.1.3"
Provider Support Matrix
| Provider | LLM Support | Embedding Support | Reranking Support | Speech-to-Text | Text-to-Speech | JSON Mode | |--------------|-------------|------------------|-------------------|----------------|----------------|-----------| | OpenAI | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | | OpenAI-Compatible | ✅ | ✅ | ❌ | ✅ | ✅ | ⚠️* | | Anthropic | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | | Groq | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | | Google (GenAI) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | | Vertex AI | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | | Ollama | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | | Perplexity | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | | Transformers | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | | ElevenLabs | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | | Azure OpenAI | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | | Mistral | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | | DeepSeek | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | | Voyage | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | | Jina | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | | xAI | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | | DashScope | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | | MiniMax | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | | OpenRouter | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ |
*⚠️ OpenAI-Compatible: JSON mode support depends on the specific endpoint implementation
Quick Start 🏃♂️
You can use Esperanto in two ways: directly with provider-specific classes or through the AI Factory.
Using AI Factory
The AI Factory provides a convenient way to create model instances and discover available providers:
from esperanto.factory import AIFactory
# Get available providers for each model type
providers = AIFactory.get_available_providers()
print(providers)
# Output:
# {
# 'language': ['anthropic', 'azure', 'dashscope', 'deepseek', 'google', 'groq', 'minimax', 'mistral', 'ollama', 'openai', 'open
