User Tier Routing

Route users by subscription tier with premium vs basic model pools.

Route users to different models based on their subscription tier. Premium users get access to high-performance models, while standard users use cost-effective alternatives.

Use Case

  • SaaS applications with premium/standard tiers

  • Different SLA requirements per user tier

  • Cost optimization based on user value

Configuration

{
  "model": "router/dynamic",
  "router": {
    "type": "conditional",
    "routes": [
      {
        "conditions": {
          "all": [
            {
              "extra.user.tier": {
                "$eq": "premium"
              }
            }
          ]
        },
        "name": "premium_user",
        "targets": {
          "$any": [
            "openai/gpt-4.1-mini",
            "xai/grok-4",
            "anthropic/claude-sonnet-4"
          ],
          "filter": {
            "error_rate": {
              "$lt": 0.01
            }
          },
          "sort_by": "ttft",
          "sort_order": "min"
        }
      },
      {
        "name": "basic_user",
        "targets": "openai/gpt-4.1-nano"
      }
    ]
  }
}

How It Works

  1. Premium Users: Get access to high-performance models (GPT-4.1-mini, Grok-4, Claude-Sonnet-4) with error rate filtering (< 1%) and sorted by fastest response time

  2. Basic Users: Use the default GPT-4.1-nano model for all requests

Variables Used

  • extra.user.tier: User subscription tier from request

Customization

  • Add more tiers (e.g., "enterprise", "basic")

  • Include different model pools for each tier

  • Add performance requirements per tier

Last updated

Was this helpful?