Skip to Content
BSGatewayGetting Started

BSGateway is a proxy that analyzes LLM API requests and automatically routes them to the most cost-effective model. It provides an OpenAI-compatible API, so you can start using it with almost no changes to your existing code.

What BSGateway Does

  • Request complexity analysis: Simple questions are routed to cheaper models, while complex reasoning goes to high-performance models
  • Cost optimization: Reduce LLM costs by up to 60% while maintaining the same response quality
  • OpenAI-compatible API: Just change the base_url and keep using your existing OpenAI/Anthropic SDK code
  • Real-time monitoring: View per-model usage, costs, and response times on the dashboard

Quick Start (5 minutes)

Step 1. Sign In

Go to gateway.bsvibe.dev  and click the Sign in with BSVibe button. If you don’t have a BSVibe account, one will be created automatically.

BSGateway Dashboard

After signing in, you’ll see the System Overview dashboard. Use the left sidebar to access each feature:

MenuDescription
DashboardOverview — request count, token usage, active rules, average response time
RulesCreate and manage routing rules
ModelsRegister LLM models and configure API keys
Routing TestSimulate routing results with test requests
AnalyticsAnalyze usage, costs, and per-model distribution
API KeysIssue and manage BSGateway API keys
Audit LogView all API call records

Step 2. Register Models

Click Models in the sidebar.

Models Page

Click the Add Model button and fill in the following:

FieldExampleDescription
ProviderAnthropicSelect the model provider
Model IDclaude-sonnetThe name used when making requests
API Keysk-ant-...The key issued by the provider
Max Tokens4096Maximum output tokens (optional)

API keys are encrypted with AES-256-GCM before storage. Even the BSGateway server cannot see the original key.

Registering multiple models allows the routing rules to automatically select the best one. We recommend registering at least 2 models (e.g., a low-cost model + a high-performance model).

Step 3. Issue an API Key

Click API Keys in the sidebar.

API Keys Page

Click the Create API Key button and:

  1. Enter a key name (e.g., production, development)
  2. Set a Rate Limit (maximum requests per minute)
  3. Click Create

Important: The API key is displayed only once when created. Make sure to copy it to a safe place.

Step 4. Make an API Call

Change only the base_url and api_key in your existing OpenAI SDK code:

from openai import OpenAI client = OpenAI( base_url="https://api-gateway.bsvibe.dev/v1", api_key="bsg_your_api_key_here", ) # Auto routing — BSGateway evaluates complexity and selects the optimal model response = client.chat.completions.create( model="auto", messages=[{"role": "user", "content": "Implement quicksort in Python"}], ) print(response.choices[0].message.content)
// Node.js / TypeScript import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://api-gateway.bsvibe.dev/v1', apiKey: 'bsg_your_api_key_here', }); const response = await client.chat.completions.create({ model: 'auto', messages: [{ role: 'user', content: 'Hello!' }], });
# cURL curl https://api-gateway.bsvibe.dev/v1/chat/completions \ -H "Authorization: Bearer bsg_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "messages": [{"role": "user", "content": "Hello!"}] }'

model Parameter Options

ValueBehavior
"auto"The classifier evaluates complexity and automatically selects the optimal model
"claude-sonnet"Directly specify a registered model ID
"fast"Use a name registered as an alias

Step 5. Verify Results

Go back to the Dashboard to see statistics for the request you just sent. Visit the Analytics page for more detailed usage and cost information.

Analytics Page

Next Steps

Last updated on