If your application already uses OpenAI-style chat-completions calls, the lowest-friction way to test another routing layer is to keep the client code familiar and change only the base URL, API key, and model id.
RouterBase is designed for that kind of experiment. It exposes an OpenAI-compatible endpoint at https://routerbase.com/v1, so existing SDK setup can stay close to what developers already know.
Environment variables
ROUTERBASE_API_KEY=your_routerbase_key
ROUTERBASE_BASE_URL=https://routerbase.com/v1
ROUTERBASE_MODEL=google/gemini-2.5-flash
Keeping the model in configuration makes it easier to compare providers later without editing the application path that calls the model.
JavaScript SDK setup
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ROUTERBASE_API_KEY,
baseURL: process.env.ROUTERBASE_BASE_URL || "https://routerbase.com/v1"
});
const completion = await client.chat.completions.create({
model: process.env.ROUTERBASE_MODEL || "google/gemini-2.5-flash",
messages: [
{
role: "user",
content: "Write a one-paragraph changelog entry for a developer tool."
}
]
});
console.log(completion.choices[0]?.message?.content);
What to verify first
Before using the setup in a production workflow, run a short checklist:
- The request succeeds with the RouterBase base URL.
- The model id is read from configuration, not hard-coded deep in the codebase.
- Errors are logged with status code and request context.
- The team has a small comparison prompt set for latency and output quality.
Useful links
- RouterBase
- RouterBase docs: https://docs.routerbase.com/
- npm quickstart package: https://www.npmjs.com/package/routerbase-quickstart
Top comments (0)