Infera
A lightweight, zero-dependency TypeScript/Node.js package that unifies multiple LLM providers under a single, standardized interface.

Website · npm
Install
npm install @gameonop/infera
Quick Start
import { openai, setKey } from '@gameonop/infera';
setKey('openai', 'sk-your-key');
const response = await openai.call({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.text);
Features
| 6 Providers | OpenAI, Groq, NVIDIA NIM, Cerebras, Gemini, OpenRouter |
| Token Counting | Automatic fallback estimation when providers don't return usage |
| Auto Retry | Exponential backoff with multi-provider fallback chains |
| Chat Sessions | Stateful conversation history with context window guard |
| Cost Estimator | Per-request cost estimates for all providers |
| Batching | Parallel execution with concurrency control |
| Templates | Type-safe prompt templates with {{variable}} interpolation |
| Output Parser | Extract JSON from any LLM response format |
| SubAgents | Scoped task agents with parallel pool support |
| Health Checks | Verify provider connectivity and API key validity |
| Streaming | SSE streaming for all supported providers |
| Zero Dependencies | Pure Node.js — no axios, no SDKs |
Supported Providers
| OpenAI | OPENAI_API_KEY | gpt-4o-mini |
| Groq | GROQ_API_KEY | llama-3.3-70b-versatile |
| NVIDIA NIM | NVIDIA_API_KEY | meta/llama-3.1-8b-instruct |
| Cerebras | CEREBRAS_API_KEY | llama3.1-8b |
| Google Gemini | GEMINI_API_KEY | gemini-2.5-flash |
| OpenRouter | OPENROUTER_API_KEY | openai/gpt-4o-mini |
Documentation
For detailed documentation, examples, and the full API reference, visit:
infera.netcanvas.live
License
Apache License 2.0 — see LICENSE for details.