How-to Guides

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:

FieldWhat to enterExample
NameDescriptive labelDowngrade sentiment-analysis to mini
FeatureX-Cost-Feature valuesentiment-analysis
Original Model (optional)Model your code callsgpt-4o
ConditionAlways, or a token-count comparison (Prompt tokens < / > a threshold)Prompt tokens <
Token ThresholdPaired with Condition, when set500
Target modelCheaper model to route togpt-4o-mini
Estimated monthly savingsYour 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 callsRoute toTypical saving
gpt-4ogpt-4o-mini~94%
claude-sonnet-4-6claude-haiku-4-5~75%
claude-opus-4-8claude-sonnet-4-6~60%
gpt-4o (async job)gpt-4o via Batch API50%

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.

On this page