If you've ever built an AI-powered app, you know the pain.
Every provider has a different API format. Different error codes. Different rate limit behavior. You write logic for Groq, then rewrite it for Gemini, then rewrite it again when you add OpenAI. Switching models means touching code everywhere.
I got tired of that. So I built novixo-ai.
What is novixo-ai?
novixo-ai is an open source TypeScript/JavaScript package that gives you one unified interface for 15 AI providers — with automatic fallback, rate-limit detection, and response caching built in.
npm install novixo-ai
Supported Providers
| Provider | Key |
|---|---|
| Groq | groq |
| Google Gemini | gemini |
| OpenAI | openai |
| Mistral | mistral |
| Anthropic | anthropic |
| Cohere | cohere |
| Together AI | together |
| Perplexity | perplexity |
| Hugging Face | huggingface |
| DeepSeek | deepseek |
| xAI (Grok) | xai |
| Fireworks AI | fireworks |
| OpenRouter | openrouter |
| AI21 | ai21 |
| NLP Cloud | nlpcloud |
Quick Start
import { NovixoAI } from "novixo-ai"
const ai = new NovixoAI({
keys: {
groq: process.env.GROQ_API_KEY,
gemini: process.env.GEMINI_API_KEY,
}
})
// Single prompt
const text = await ai.ask("Explain recursion in simple terms")
console.log(text)
// Multi-turn conversation
const res = await ai.chat([
{ role: "user", content: "What is a binary tree?" },
{ role: "assistant", content: "A binary tree is..." },
{ role: "user", content: "Show me an example in JavaScript" }
])
console.log(res.text)
console.log(res.provider) // "groq" — tells you which provider answered
That's it. No provider-specific setup. No custom error handling per API.
How Auto-Fallback Works
This is the feature I'm most proud of.
You define a priority order. novixo-ai tries each provider left to right:
- If a provider is rate limited → skipped automatically, retried after cooldown
- If a provider fails → next one is tried instantly
- If all fail → throws a detailed error showing what each provider returned
const ai = new NovixoAI({
keys: {
groq: process.env.GROQ_API_KEY,
gemini: process.env.GEMINI_API_KEY,
openai: process.env.OPENAI_API_KEY,
},
// Try Groq first, fall back to Gemini, then OpenAI
providers: ["groq", "gemini", "openai"]
})
No extra code on your end. It just works.
Response Caching
Duplicate prompts don't hit the API twice. The cache is in-memory with a configurable TTL.
const ai = new NovixoAI({
keys: { groq: process.env.GROQ_API_KEY },
cache: true, // enabled by default
cacheTTL: 300_000 // 5 minutes (default)
})
// First call — hits the API
await ai.ask("What is TypeScript?")
// Same prompt again — served from cache instantly
await ai.ask("What is TypeScript?") // res.cached === true
Saves tokens. Saves money. Especially useful during development.
Works With Free Tier Keys
You don't need a paid plan to get started. Groq and Gemini both have generous free tiers.
const ai = new NovixoAI({
keys: {
groq: process.env.GROQ_API_KEY, // free
gemini: process.env.GEMINI_API_KEY // free
}
})
Add more providers as you scale. The fallback order is fully in your control.
The OpenRouter Trick
If you only have one API key, use OpenRouter. One OpenRouter key gives you access to 100+ models from every provider — and novixo-ai supports it natively.
const ai = new NovixoAI({
keys: {
openrouter: process.env.OPENROUTER_API_KEY
},
models: {
openrouter: "anthropic/claude-3-haiku" // pick any model
}
})
With System Prompts
const res = await ai.chat(
[{ role: "user", content: "Summarise this for me: ..." }],
{ systemPrompt: "You are a concise academic writing assistant." }
)
Force a Specific Provider Per Call
const res = await ai.chat(messages, {
providers: ["openai"] // only use OpenAI for this one call
})
Full TypeScript Support
Everything is typed — providers, messages, config, and responses.
import type { NovixoAIConfig, AIResponse, Provider } from "novixo-ai"
const res: AIResponse = await ai.chat(messages)
// res.text, res.provider, res.model, res.cached, res.durationMs
Part of the NovixoTech Ecosystem
novixo-ai is one of three open source packages under NovixoTech:
- novixo-engine — offline-first network SDK with AES-256-GCM encrypted queuing, service workers, and endpoint failover
- novixo-agent-logger — audit trail for AI agent actions
- novixo-ai — multi-provider AI client ← you are here
All free. All open source.
Links
If this saves you time, a GitHub star means a lot. And if you run into anything or want a provider added, open an issue — contributions are very welcome.
Built by @NovixoTech
Top comments (1)
I will have to give it a try, then