Introduction
Unified, strictly-typed, asynchronous Python 3.12+ gateway for multi-provider AI APIs.
NexusAI-Client âĄ
NexusAI-Client is an ultra-lightweight, strictly-typed, asynchronous Python 3.12+ gateway for multi-provider AI APIs. It unifies Cerebras, Cohere, DeepSeek, Google Gemini (Free & Pro), Groq, Mistral, Nvidia NIM, OpenRouter, and OrcaRouter behind a single, elegant interface with zero heavy vendor SDK dependencies.
ðĄ Why NexusAI-Client?
Modern AI applications frequently need to juggle between multiple LLM providers for cost optimization, high throughput, and high availability. Traditionally, this required installing 9 or 10 separate proprietary SDKs (google-genai, openai, groq, cohere, mistralai, etc.).
This practice leads to:
- Dozens of conflicting transitive dependencies and bloating container sizes.
- Incompatible async models and diverging parameter names.
- Slow startup and excessive memory overhead.
NexusAI-Client fixes this from the ground up:
- ð Dynamic Model Management & Auto-Rotation: Automatic failover on HTTP 404/400 (deprecated models), HTTP 429 rate limits, and timeouts across models and providers.
- ðŠķ Zero Heavyweight Dependencies: Powered purely by
httpxandpython-dotenv. - ⥠Native Asynchronous & SSE Streaming: Stream responses token-by-token in real time via
stream_text()andstream_chat(). - ð Zero-Cost-First Smart Fallback: Automatic progression from 100% Free Tiers (Gemini, Groq, Cerebras, Cohere, Nvidia, OpenRouter, OrcaRouter, Mistral) to Paid Backups (
AIGateway.auto_fallback()). - ð ïļ Universal Tool Calling / Function Calling: Standardized function schema, automatic JSON argument parsing, and multi-turn agent loops across Groq, Cerebras, Mistral, DeepSeek, Gemini REST, Cohere V2, and Nvidia NIM.
- ð World-Record Hardware Accelerators: Tap into Groq LPUs and Cerebras CS-3 Wafer-Scale engines (2,000+ tokens/sec).
- ð§ Enterprise Reasoning & Search Models: Native Cohere Command R+, DeepSeek R1, and Qwen 3.8 models.
- ðŊ Guaranteed JSON Outputs: Native
json_mode=Trueacross all supported providers. - ð° Live Account & Budget Inspection: Inspect real-time balances (USD, NGC credits) and rate limits (RPM, TPM, RPD).
- ð 670+ Models Discovered Live: Automatic detection of free-tier models (
:free,-free) and accurate per-million-token pricing.
ð 1-Minute Quick Start
import asyncio
from nexusai_client import AIGateway
async def main():
# Automatically discovers active keys in .env and routes: Free -> Free -> Paid
async with AIGateway.auto_fallback() as client:
response = await client.generate_text("Explain quantum computing in 2 sentences.")
print(f"â
Served by [{response.provider}] with zero downtime:")
print(response.text)
if __name__ == "__main__":
asyncio.run(main())ð§ Explore the Documentation
- Installation: How to install via
pip,uv, orpoetry. - Configuration: Setting up environment variables and API keys.
- Providers Matrix: Complete breakdown of all 10 supported providers.
- Core Features: Streaming, vision analysis, fallback routing, and quota inspections.
- Cookbooks & Recipes: FastAPI microservices, chat sessions, and background workers.
- API Reference: Detailed signatures for classes, methods, models, and exceptions.