Examples
This directory contains focused, practical examples of LangDB's routing capabilities. Each example demonstrates a specific routing pattern that you can adapt for your use case.
Quick Examples
| Example | Description | Use Case |
|---|---|---|
| User Tier Routing | Route users to different models based on their subscription tier | SaaS applications with premium/standard tiers |
| Rate Limiter Routing | Enforce usage quotas and route accordingly | Prevent abuse, manage costs |
| Topic Routing | Route to specialized models based on content topic | Content-specific optimization |
| Load Balancer Routing | Distribute requests across multiple models | High availability, performance |
| Group Based Routing | Route based on LangDB cost groups for teams/departments | Team budgets, dev vs prod separation |
| Region Based Routing | Route based on user's geographic region | Data residency, performance optimization |
How to Use These Examples
- Copy the JSON configuration from any example
- Modify the conditions and targets to match your requirements
- Test with your specific use case
- Combine multiple patterns for complex routing scenarios
Advanced Examples
For more complex, multi-layered routing configurations, see: