The Problem
Teams often start with one model provider and later need lower latency, fallback options, media generation, or access to several providers without rewriting every integration. Hardcoding provider-specific SDK settings across services makes model changes slow and risky.
The Solution
Use the routerbase-gateway skill to configure routerbase as an OpenAI-compatible gateway. The agent can update the base URL, keep ROUTERBASE_API_KEY server-side, verify model IDs, and document a primary/fallback model plan.
npx terminal-skills install routerbase-gateway
Step-by-Step Walkthrough
1. Ask the agent to inspect the current integration
Move our existing OpenAI chat completion code to RouterBase. Keep the same request shape, put the key in ROUTERBASE_API_KEY, and give me a smoke test.
The agent finds OpenAI-compatible client setup, identifies where the API key and base URL live, and avoids changing unrelated app logic.
2. Update the gateway configuration
The agent changes the client configuration to use:
base URL: https://routerbase.com/v1
env var: ROUTERBASE_API_KEY
It keeps the existing chat message format, streaming mode, tool schema, or JSON response format unless the selected RouterBase model requires a change.
3. Choose the routing plan
Ask:
Pick a fast primary model and a stronger fallback for our support-chat workload. Include what we need to test before production.
The agent creates a routing table with a primary model, fallback model, retry conditions, and validation prompts. It marks model IDs and pricing as items to verify against the live RouterBase catalog.
4. Add media generation when needed
Ask:
Add a RouterBase image generation example for product screenshots and explain how video jobs should be polled.
The agent selects the image or video endpoint, creates a minimal request, and documents whether the response is synchronous or asynchronous.
Real-World Example
An AI support startup uses one provider for early prototypes. As traffic grows, the team wants fast default responses, stronger fallback models for difficult tickets, and image generation for help-center assets.
- The backend engineer asks the agent to migrate the existing OpenAI client to RouterBase.
- The agent changes only the base URL and key configuration, then adds a backend-only smoke test.
- The product engineer asks for a model routing plan for support chat.
- The agent documents a fast primary model, a stronger fallback, retry rules, and validation prompts.
- The content team asks for image generation examples.
- The agent adds RouterBase media endpoint examples and warns that generated files should be stored by the application.
The result is one gateway integration, one environment variable, and a clear routing plan instead of scattered provider-specific settings.
Related Skills
- routerbase-gateway -- Integrate RouterBase, choose model routes, and call chat or media endpoints.
- api-tester -- Smoke test RouterBase-compatible HTTP requests and validate responses.
- mcp-server-builder -- Expose RouterBase-backed workflows through MCP tools when an agent needs reusable callable actions.