Langsung ke konten
Skillpedia
Agen48k · #5647

routerbase-model-gateway

Fungsinya

RouterBase bertindak sebagai penerjemah agar berbagai model AI (seperti GPT, Claude, dan Gemini) bisa berkomunikasi dengan aplikasi Anda. Dengan RouterBase, Anda bisa menggunakan satu pintu masuk untuk mengakses berbagai model tanpa memperlihatkan kunci akses Anda.

Kapan dipakai

  • ✓Saat memindahkan aplikasi yang sudah menggunakan OpenAI API ke RouterBase.
  • ✓Saat memilih model AI mana yang akan dipakai untuk tugas yang berbeda (teks, gambar, audio).
  • ✓Saat mencoba cara mengatur RouterBase untuk berbagai fitur, seperti respons real-time atau format tertentu.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/routerbase-model-gateway/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/routerbase-model-gateway/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Bagaimana cara mengatur aplikasi saya agar menggunakan RouterBase, bukan OpenAI API secara langsung?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Aplikasi Anda mengirim permintaan ke RouterBase, yang kemudian meneruskannya ke model AI yang paling sesuai. RouterBase yang menangani komunikasi dengan berbagai model dan memastikan kunci akses Anda tetap aman.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

RouterBase Model Gateway

Overview

Use routerbase when an application needs one OpenAI-compatible API surface for model routing across GPT, Claude, Gemini, image, video, audio, and embedding workloads. This skill helps agents migrate existing OpenAI SDK calls, document model-selection tradeoffs, and produce safe implementation snippets without exposing credentials.

RouterBase model availability, pricing, and provider capabilities can change, so treat examples as starting points and verify current catalog data before production recommendations.

When to Use This Skill

  • Use when migrating an OpenAI-compatible client to RouterBase by changing the base URL and model ID.
  • Use when selecting primary and fallback models for chat, reasoning, vision, media generation, audio, or embeddings.
  • Use when debugging RouterBase request setup, headers, environment variables, streaming, tool calls, JSON mode, or multimodal payloads.
  • Use when documenting an internal model-routing plan that balances cost, latency, quality, and provider redundancy.

How It Works

Step 1: Classify the Workload

Identify the modality and hard constraints before choosing a model:

  • Modality: chat, vision, image, video, audio, embeddings, or mixed.
  • Quality target: draft, production, high-stakes review, or automated background task.
  • Runtime constraints: latency budget, context length, streaming, JSON mode, tool calling, and retry tolerance.
  • Business constraints: price ceiling, provider preference, regional requirements, and fallback rules.

Step 2: Configure the OpenAI-Compatible Client

Keep the RouterBase API key server-side in an environment variable such as ROUTERBASE_API_KEY. Do not put keys in browser, mobile, or public repository code.

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

Step 3: Validate Model IDs and Capabilities

When credentials and network access are available, check the live catalog before locking in a model ID or price-sensitive recommendation.

curl "https://routerbase.com/api/v1/models?task=chat" \
  -H "Authorization: Bearer $ROUTERBASE_API_KEY"

Confirm feature assumptions with a small request fixture:

  • Streaming works when stream: true is set.
  • Tool calling accepts the exact schema used by the app.
  • JSON mode returns parseable output and still passes application validation.
  • Vision or media payloads use the expected OpenAI-compatible content shape.

Step 4: Design Fallbacks Conservatively

Use explicit application-level fallbacks unless the user's RouterBase account already has a smart-routing policy configured.

const modelPlan = [
  "anthropic/claude-sonnet-4-6",
  "google/gemini-2.5-flash",
];

for (const model of modelPlan) {
  try {
    return await client.chat.completions.create({ model, messages });
  } catch (error) {
    if (!isRetryableRouterBaseError(error)) throw error;
  }
}

Treat transient network errors, timeouts, rate limits, and server errors as candidates for retry. Do not blindly retry authentication failures, invalid model IDs, validation errors, or policy refusals.

Examples

Migration Checklist

When converting an existing OpenAI SDK integration:

  1. Change the base URL to https://routerbase.com/v1.
  2. Read ROUTERBASE_API_KEY from server-side environment configuration.
  3. Replace the model name with a RouterBase model ID that matches the task.
  4. Preserve standard OpenAI request fields unless RouterBase documentation says otherwise.
  5. Run one minimal smoke test before shipping.

Routing Plan Format

Use this table when recommending a model strategy:

Use case Primary model Fallback model Reason Validation

…

Pertanyaan umum

Apa itu 'model'?

Model adalah jenis kecerdasan buatan yang bisa memproses permintaan Anda, misalnya yang menghasilkan teks, gambar, atau audio.

Mengapa saya tidak boleh memasukkan API key ke dalam kode?

Memasukkan API key langsung ke dalam kode adalah risiko keamanan. Siapa pun yang punya akses ke kode bisa melihat dan memakai kunci Anda, yang bisa menyebabkan biaya tak terduga atau akses tanpa izin.

Apa maksud 'memigrasikan OpenAI client'?

Maksudnya adalah menyesuaikan aplikasi yang sudah dibuat untuk OpenAI API agar bisa bekerja dengan RouterBase, biasanya cukup dengan mengubah beberapa pengaturan saja.

Detail

Deskripsi asli dari pembuat

Integrate RouterBase as an OpenAI-compatible model gateway for routing GPT, Claude, Gemini, media, audio, and embedding requests.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#5647
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa