How do I apply routing rules to automatically switch models?
Create a routing rule in the dashboard to redirect GPT-4o to GPT-4o-mini (or any cheaper model) for matching calls — no code changes, savings apply immediately.
Goal: Automatically redirect expensive model calls to cheaper equivalents for specific features — without changing a single line of application code.
Time: 2 minutes from dashboard to active rule. Savings appear on the next call.
Prerequisite: At least a few days of attributed calls so you can see which features are using expensive models unnecessarily. Run one-click recommendations first to identify candidates.
Step 1 — Identify the rule candidate
Click Recommendations in the sidebar (a separate page from AI Advisor). Look for model-mismatch cards — these are features using frontier models for simple tasks. Each card shows the over-provisioned feature/model and an estimated monthly saving.
Alternatively, go to Feature Intelligence and look for features with high cost but short average output tokens — a signal that a cheaper model would handle them identically.
Step 2 — Apply from the Recommendations page (fastest path)
Click Apply Recommendation on a model-mismatch card. Cognocient immediately creates an active routing rule for that feature/model pair — there's no separate preview or confirm step; the rule takes effect right away. The new rule then shows up on the Routing Rules page.
After applying, check the API Call Log — matching calls will carry an x-cog-routed: true header (plus x-cog-routed-rule naming the rule) once the rule is live.
Step 3 — Create a rule manually
For custom conditions, create the rule from scratch:
Go to Routing Rules → New Rule and fill in:
| Field | What to enter | Example |
|---|---|---|
| Name | Descriptive label | Downgrade sentiment-analysis to mini |
| Feature | X-Cost-Feature value | sentiment-analysis |
| Original Model (optional) | Model your code calls | gpt-4o |
| Condition | Always, or a token-count comparison (Prompt tokens < / > a threshold) | Prompt tokens < |
| Token Threshold | Paired with Condition, when set | 500 |
| Target model | Cheaper model to route to | gpt-4o-mini |
| Estimated monthly savings | Your own estimate, shown on the rule card | $140 |
There is no shadow/preview mode — a rule you create is active as soon as you save it (or you can leave it paused and activate it later; see Step 4).
Model compatibility reference
| If your code calls | Route to | Typical saving |
|---|---|---|
gpt-4o | gpt-4o-mini | ~94% |
claude-sonnet-4-6 | claude-haiku-4-5 | ~75% |
claude-opus-4-8 | claude-sonnet-4-6 | ~60% |
gpt-4o (async job) | gpt-4o via Batch API | 50% |
Cross-provider redirects (e.g., OpenAI → Anthropic) change the response object format. If your code accesses provider-specific fields (like logprobs or usage.cache_read_input_tokens), test on a low-traffic feature first — there's no shadow/dry-run mode to validate this before the rule goes live.
Step 4 — Monitor the impact
After activating, check the "Cost by Feature (30d)" chart for the affected feature — cost should drop within 24 hours. Each rule card on the Routing Rules page shows its estimated monthly savings figure (a static value you or the recommendation set — not a live "calls redirected" counter; there's no per-rule count of matched or bypassed calls in the UI today).
If quality issues arise, click Pause on the rule — the original model resumes immediately, with no deployment needed.
Related articles
Tag Your First AI Call
Add 2 headers to your existing code and see per-feature spend in under 5 minutes.
Set a Monthly Spending Limit
Create a hard budget enforced at the proxy before charges reach your provider bill.
Cut Your AI Bill with One Click
Use AI Advisor recommendations to apply model downgrades and caching without code changes.