Integrations

RouterBase API Integration

Try it

Integrate applications with RouterBase, the OpenAI-compatible model gateway at https://routerbase.com/v1. Use when migrating OpenAI SDK calls to RouterBase,...

What it does

Integrate applications with RouterBase, the OpenAI-compatible model gateway at https://routerbase.com/v1. Use when migrating OpenAI SDK calls to RouterBase,...

The skill document

RouterBase API Integration

Overview

Use routerbase as an OpenAI-compatible gateway for GPT, Claude, Gemini, and other supported models. This skill helps agents migrate existing OpenAI-compatible code, keep API keys server-side, and produce concise, testable RouterBase integration snippets.

Read references/routerbase-api.md when exact endpoint details, headers, or examples are needed.

Integration Workflow

  1. Identify whether the user is asking for migration, a new integration, debugging, or documentation.
  2. Keep credentials out of client/browser code. Prefer ROUTERBASE_API_KEY in server-side environment configuration.
  3. Reuse the user's existing OpenAI-compatible client when possible. Change the base URL to https://routerbase.com/v1, then swap the model to a RouterBase model ID.
  4. Preserve standard OpenAI request shapes unless RouterBase docs or the selected model require a model-specific field.
  5. For model IDs, use the live model catalog when an API key is available; otherwise use documented examples only as a starting point and tell the user to verify current availability.
  6. Add a minimal smoke test, but do not run it unless credentials are present and the user expects a live API call.

Common Patterns

Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ROUTERBASE_API_KEY"],
    base_url="https://routerbase.com/v1",
)

response = client.chat.completions.create(
    model="google/gemini-2.5-flash",
    messages=[{"role": "user", "content": "Write one sentence about model routing."}],
)

print(response.choices[0].message.content)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ROUTERBASE_API_KEY,
  baseURL: "https://routerbase.com/v1",
});

const response = await client.chat.completions.create({
  model: "google/gemini-2.5-flash",
  messages: [{ role: "user", content: "Write one sentence about model routing." }],
});

console.log(response.choices[0].message.content);

curl

curl -X POST https://routerbase.com/v1/chat/completions \
  -H "Authorization: Bearer $ROUTERBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [{"role": "user", "content": "What is 2+2?"}]
  }'

Implementation Guardrails

  • Never paste or log real API keys. Use placeholders like sk-rb-... only in docs.
  • Never put RouterBase keys in browser, mobile, or public repository code.
  • Keep examples OpenAI-compatible unless the user asks for a framework-specific adapter.
  • For streaming, set stream: true and process Server-Sent Events or SDK stream chunks.
  • For tool calling and JSON mode, keep the standard OpenAI fields tools and response_format.
  • For multimodal chat, use OpenAI content parts with text and image_url.
  • If a live request fails, check headers, model ID, endpoint path, rate limits, and account access before changing application logic.

Output Checklist

  • Include the changed base URL.
  • Include where ROUTERBASE_API_KEY should be configured.
  • Include one minimal request example.
  • Include a clear note when model IDs or prices should be checked against the live RouterBase catalog.
  • Include a test command or dry-run validation path.

Related skills

Choose RouterBase model IDs and routing strategies for chat, image, video, audio, and embeddings workloads. Use when comparing providers, selecting GPT, Clau...

1 installs

Build image, video, and audio generation workflows on RouterBase. Use when calling RouterBase image, video, audio, speech, or media APIs; selecting media mod...

Smart LLM Router for OpenClaw. Save up to 70% by routing every request to the right model. No coding required.

13 installs

OpenAI-compatible LLM gateway for AI agents — point your OpenAI client's base_url here and pay per call in USDC via x402 (Base or Solana) or a funded key. 17...

1 installs

Call GPT generation and OpenAI text embedding models through RunAPI using OpenAI-compatible clients. Use for chat, Responses, embeddings, streaming, tools, vision, or an existing compatibility client that needs the conditional reference.

12 installs

One API and one credential for frontier and open-source LLMs, built into your Neon branch and powered by Databricks. Use when a user wants to call an LLM, add AI/chat/an agent to their app, route between model providers (OpenAI, Anthropic, Google/Gemini, Meta, Alibaba, DeepSeek), or avoid juggling separate provider API keys and accounts — especially when they already use Neon and want AI requests to branch with their project. Works with the OpenAI SDK, Anthropic SDK, google-genai, the Vercel AI SDK, and Mastra by changing only the base URL. Triggers include "call an LLM", "add AI to my app", "chat completion", "model routing", "LLM proxy/gateway", "one API for all models", "use Claude/GPT/Gemini", "AI SDK", "Mastra agent", "Neon AI Gateway", and "log/rate-limit AI calls".