Dynamic Model Management

Zero-downtime model changes, per-key aliases, and runtime weight tuning

Overview

SBproxy lets you control which models are available, how traffic is distributed across them, and what model names your clients see, all without redeploying or restarting your gateway. Changes take effect on the next request.

Capabilities

  • Enable and disable models at runtime - Remove a model from rotation instantly when a provider has an outage or when you want to sunset a model version. No config change or restart needed.
  • Weight tuning - Shift traffic between models in real time. Gradually ramp up a new model from 10% to 100% while monitoring quality and cost.
  • Per-key model aliases - Give each API key its own mapping of friendly names to actual models. Clients use stable names like fast or smart while you swap underlying models transparently.
  • Workspace scoping - Each workspace controls its own model availability. A staging workspace can test new models while production stays on proven ones.
  • Distributed cache management - Flush cached responses by model, namespace, or globally across all gateway instances when you change model configurations.

Runtime Model Control

Disable a model across your gateway without touching the configuration:

features:
  ai.models.gpt-4-turbo.enabled: false

Disabled models are removed from the /v1/models response and are no longer eligible for routing. Re-enable by setting the flag back to true or removing it.

Traffic Weight Tuning

Override provider weights at runtime to shift traffic between models:

features:
  ai.models.gpt-4o.weight: 80
  ai.models.gpt-4o-mini.weight: 20

Weight overrides apply on top of your routing configuration. Use this for gradual rollouts, cost optimization experiments, or responding to provider performance changes in real time.

Per-Key Model Aliases

Each API key can define its own model alias map. Clients use stable, friendly names while you control which actual model is called:

model_aliases:
  fast: gpt-4o-mini
  smart: claude-sonnet-4-20250514
  balanced: gpt-4o

When a client sends "model": "fast", the gateway resolves it to the actual model before routing. The resolved model appears in response headers and analytics.

Use Cases

  • Model comparison - Point the smart alias to different models for different keys and compare quality metrics side by side.
  • Cost optimization - Redirect the default alias to a cheaper model for low-priority keys without any client-side changes.
  • Drop-in migration - When a provider releases a new model, update the alias target and existing clients pick it up on the next request.
  • Tiered access - Free-tier keys map smart to a smaller model. Premium keys map it to the most capable model available.

Cache Invalidation

When you change model configurations, you can flush cached responses to ensure clients get fresh results. Cache operations are distributed across all gateway instances automatically:

  • Flush by model - Clear all cached responses for a specific model after changing its routing or disabling it.
  • Flush by namespace - Clear cache for a specific workspace or prompt configuration.
  • Flush all - Clear the entire cache globally or for a single workspace.
  • Delete single entry - Remove a specific cached response by key.