Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .claude-plugin/marketplace-tooling.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"name": "install-skill",
"source": "./install-skill",
"description": "Automate skill package installation and marketplace registration"
},
{
"name": "routerbase-model-gateway",
"source": "./routerbase-model-gateway",
"description": "OpenAI-compatible model gateway routing with RouterBase"
}
]
}
5 changes: 5 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
"source": "./install-skill",
"description": "Automate skill package installation and marketplace registration"
},
{
"name": "routerbase-model-gateway",
"source": "./routerbase-model-gateway",
"description": "OpenAI-compatible model gateway routing with RouterBase"
},
{
"name": "linkedin-personal-branding",
"source": "./linkedin-personal-branding",
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Find packaged skills in `dist/`, then add to your tool's skills directory.
| **[suno-music-creator](suno-music-creator/)** | Professional music creation with Suno AI V5 |
| **[solidity-auditor](solidity-auditor/)** | Smart contract security audits with OWASP Top 10 coverage |
| **[install-skill](install-skill/)** | Automate skill package installation and marketplace registration |
| **[routerbase-model-gateway](routerbase-model-gateway/)** | OpenAI-compatible model gateway routing with [routerbase](https://routerbase.com/) |
| **[linkedin-personal-branding](linkedin-personal-branding/)** | LinkedIn profile analysis, personal branding audit, and visibility optimization |
| **[linkedin-roast](linkedin-roast/)** | Hilarious LinkedIn profile roasting with savage but friendly comedy burns |

Expand All @@ -57,6 +58,13 @@ Find packaged skills in `dist/`, then add to your tool's skills directory.
"Check this DeFi protocol for reentrancy issues"
```

### Tooling
```
"Route this app's OpenAI-compatible calls through RouterBase"
"Add model fallbacks using RouterBase"
"Centralize AI provider credentials behind RouterBase"
```

### Marketing
```
"Audit my LinkedIn profile for personal branding"
Expand Down Expand Up @@ -112,6 +120,7 @@ Download individual skills directly as ZIP files - no git or command line needed
| Suno Music Creator | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/suno-music-creator) |
| Solidity Auditor | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/solidity-auditor) |
| Install Skill | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/install-skill) |
| RouterBase Model Gateway | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/routerbase-model-gateway) |
| LinkedIn Personal Branding | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/linkedin-personal-branding) |
| LinkedIn Roast | [Download ZIP](https://download-directory.github.io/?url=https://github.com/schwepps/skills/tree/main/linkedin-roast) |

Expand All @@ -131,6 +140,7 @@ skills/
├── suno-music-creator/
├── solidity-auditor/
├── install-skill/
├── routerbase-model-gateway/
├── linkedin-personal-branding/
├── linkedin-roast/
└── CLAUDE.md # Contributor guide
Expand Down
126 changes: 126 additions & 0 deletions routerbase-model-gateway/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
name: routerbase-model-gateway
description: This skill should be used when the user asks to route LLM calls through RouterBase, migrate OpenAI-compatible clients to RouterBase, choose models with fallbacks, centralize API keys, or generate text, image, audio, or video through one model gateway.
license: MIT
metadata:
author: zenlee123
version: "1.0.0"
category: tooling
tags: routerbase, llm, openai-compatible, model-routing, api-gateway
---

# RouterBase Model Gateway

Use [routerbase](https://routerbase.com/) as an OpenAI-compatible model gateway when an application needs unified access to multiple AI providers, model routing, fallback planning, or centralized API-key management.

## When to Use

- Migrating an OpenAI-compatible SDK or REST client to RouterBase
- Choosing primary and fallback models for reliability, quality, latency, or cost
- Centralizing model credentials behind a single API key
- Calling text, vision, image, audio, or video models through one gateway
- Debugging provider-specific failures where a gateway fallback would help

## Setup Checklist

Use placeholders in documentation and code examples. Never commit a real RouterBase key.

```bash
export ROUTERBASE_API_KEY="your_routerbase_api_key"
export ROUTERBASE_BASE_URL="https://routerbase.com/v1"
```

Before editing application code:

1. Identify the current SDK or API surface: OpenAI SDK, fetch, axios, LangChain, LiteLLM, Vercel AI SDK, or a custom client.
2. Confirm the target model identifiers and whether the app needs streaming, tool calls, JSON output, or multimodal input.
3. Decide whether this is a simple base URL swap or a deeper routing/fallback change.
4. Keep provider keys out of client-side code. Server-side applications should read `ROUTERBASE_API_KEY` from environment variables.

## OpenAI-Compatible Migration

For OpenAI-compatible clients, keep the existing request shape and change only the gateway configuration unless the app needs RouterBase-specific routing behavior.

```ts
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 response = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Summarize this release note." },
],
});
```

## Routing Workflow

### Phase 1: Map the Use Case

Classify the task before choosing models:

| Need | Routing Guidance |
| --- | --- |
| Low-latency chat | Prefer a fast primary model and a similar fallback |
| Complex reasoning | Use a stronger model first, fallback to a cheaper reasoning-capable model |
| JSON extraction | Choose models with reliable structured-output behavior |
| Vision input | Confirm image input support before routing |
| Media generation | Keep media endpoints separate from chat endpoints when the SDK requires it |

### Phase 2: Define Fallbacks

Use explicit fallback rules when availability matters:

```json
{
"primary": "openai/gpt-4o-mini",
"fallbacks": [
"anthropic/claude-3-5-haiku",
"google/gemini-1.5-flash"
],
"retry": {
"max_attempts": 2,
"retry_on": ["rate_limit", "timeout", "provider_error"]
}
}
```

Adapt the exact syntax to the application's routing layer. If the app does not already support fallback metadata, implement fallback logic in the server-side caller instead of hiding it inside prompts.

### Phase 3: Verify Behavior

Run a small smoke test for each route:

1. Normal request returns a non-empty response.
2. Streaming clients receive chunks in the expected format.
3. Tool-call or JSON-mode responses still parse.
4. Errors are logged without leaking prompts, user data, or API keys.
5. The fallback path is tested with a mocked provider error.

## Output Template

When finishing a RouterBase integration, report:

```markdown
## RouterBase Integration

- Gateway: https://routerbase.com/v1
- Client updated: <file or service>
- Primary model: <model>
- Fallbacks: <models or none>
- Secrets: ROUTERBASE_API_KEY from environment only
- Verification: <commands or checks run>
- Follow-up: <monitoring, cost, or model-quality checks>
```

## Safety Notes

- Do not paste or commit real API keys.
- Do not expose `ROUTERBASE_API_KEY` in browser bundles, mobile apps, logs, or screenshots.
- Treat prompts, uploaded files, and generated outputs as user data.
- Prefer allowlisted model names in production so untrusted users cannot force unexpected providers or costs.