cd /news/developer-tools/point-the-openai-sdk-at-routerbase-i… · home topics developer-tools article
[ARTICLE · art-45281] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Point the OpenAI SDK at RouterBase in a few minutes

RouterBase offers an OpenAI-compatible endpoint that lets developers switch routing layers by changing only the base URL, API key, and model ID in their existing client code. A developer demonstrates how to configure the OpenAI SDK to point at RouterBase's endpoint, enabling quick testing of different models like Google's Gemini 2.5 Flash without altering the application's core logic.

read1 min views1 publishedJun 30, 2026

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.

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.

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);

Before using the setup in a production workflow, run a short checklist:

── more in #developer-tools 4 stories · sorted by recency
── more on @routerbase 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/point-the-openai-sdk…] indexed:0 read:1min 2026-06-30 ·