- Home
- Skills
- Agents & Orchestration
- Routegrail
Routegrail
by Sujal Tangde
Pool free-tier LLM APIs with automated failover, quota tracking, and privacy-aware routing for Node.js projects.
Free
Routegrail
Example session with this skill installed
Set up RouteGrail in my Next.js project. I have Groq and Mistral keys ready. I need to ensure it doesn't log prompts for privacy.
- Read your context and instructions
- Compiled the routegrail
I have integrated RouteGrail into your project. I installed the package, configured the environment variables, and created a singleton router instance with prompt logging disabled for privacy.
Next.js RouteGrail Integration
First, I added the following to your .env.local:
GROQ_API_KEY=your_key_here
MISTRAL_API_KEY=your_key_here
Then, I created a shared library file to manage the router instance:
// lib/llm.ts
import { Router } from "routegrail";
// Singleton router instance to track quotas across requests
export const llm = new Router({
allowPromptLogging: false, // Privacy: prevents routing to Gemini/Mistral training tiers
providers: {
groq: { apiKey: process.env.GROQ_API_KEY },
mistral: { apiKey: process.env.MISTRAL_API_KEY },
},
});
/**
* Helper to generate text with failover
*/
export async function askLLM(prompt: string) {
try {
const res = await llm.generate({
prompt,
system: "You are a helpful assistant.",
});
return {
text: res.text,
source: `${res.provider} (${res.model})`,
};
} catch (error) {
console.error("LLM Failure:", error);
throw error;
}
}
Finally, I created a verification script scripts/check-llm.mjs to test the connection.
Next steps
- Add your actual API keys to the
.env.localfile. - Run
node --env-file=.env.local scripts/check-llm.mjsto verify provider health. - Import
llmfrom@/lib/llmin your Server Actions or API routes.
Connects securely to your tools. The creator never sees your data.
About this skill
Building LLM-powered features often leads to a wall of 429 rate limit errors or expensive API bills. This skill integrates RouteGrail into your Node.js or TypeScript project to pool free-tier LLM providers into a single, high-availability endpoint.
What it does
- Automated Failover automatically reroutes requests to a different provider in the same model family if the primary hits a rate limit.
- Quota Tracking monitors remaining capacity across all configured providers to prevent wasted calls.
- Provider Discovery identifies which models are reachable with your specific API keys at runtime.
- Privacy Controls allows you to exclude specific providers that train on prompts or skip regions where free tiers are unavailable.
- Intelligent Routing selects models based on requirements like JSON mode, long context windows, or specific performance tiers.
How it works
- Dependency Injection installs the zero-dependency package and configures the project's environment variables for supported providers.
- Router Initialization creates a singleton instance that manages global state and background model discovery.
- Integration replaces standard LLM calls with the router's generation or streaming methods.
- Validation runs a verification script to audit provider health and connectivity.
Frameworks & tools
Requires Node.js 18.17+ and works with ESM or TypeScript. It is compatible with frameworks like Next.js, Remix, Nuxt, and SvelteKit, and supports providers including Groq, Gemini, OpenRouter, Mistral, and Cloudflare.
Why this beats prompting it yourself
Writing reliable failover logic requires handling diverse error codes, tracking varying rate limits, and mapping model aliases across multiple vendors. This skill automates the boilerplate and implements professional error handling that distinguishes between transient rate limits and terminal request errors.
Use cases
- Building prototypes or side projects without incurring API costs.
- Scaling internal tools that exceed a single free-tier quota.
- Improving reliability for CI/CD scripts that use LLMs for testing.
- Creating privacy-conscious apps by excluding providers that log prompt data.
Known limitations
Not intended for high-concurrency production apps with many simultaneous users. Free tiers are mostly limited to open-weight models and Gemini Flash rather than frontier models like GPT-4 or Claude.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 7 days ago
- Free with an Agensi account
- Software
Node.js
Permissions
What's inside
Frequently Asked Questions
New in Agents & Orchestration
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.