Cookbook
Multi-Model Routing Strategy
Separate platform node failover from business model selection and design tiers around tasks, costs, and quality.
APIQIK node-level failover addresses availability for the same model. Application-level multi-model strategies balance task quality, speed, and cost.
Two different kinds of routing
Platform node routing
- Performed automatically on the server.
- Aims to improve request availability.
- Requires no developer-maintained nodes.
- Keeps the response structure compatible.
Business model routing
- Chosen by the application for each task.
- Balances quality, latency, and cost.
- Requires evaluation and gradual rollout.
- Must account for model capability differences.
Simple selector
def choose_model(task):
if task["requires_complex_reasoning"]:
return "deepseek-chat"
if task["latency_sensitive"]:
return "qwen-turbo"
return "qwen-turbo"
model = choose_model({
"requires_complex_reasoning": False,
"latency_sensitive": True,
})This only illustrates a policy. Configure production routing from your own evaluations rather than hard-coding unverified model preferences.
Degradation order
- Reduce unnecessary output length or disable supplementary generation.
- Queue low-priority requests or return cached results.
- Switch to a fallback model evaluated on the same task.
- Fail explicitly if output quality cannot be assured instead of returning unvalidated results.
Evaluation and rollout
- Maintain fixed evaluation datasets and scoring scripts for repeatable comparisons.
- Account for extra cost and data-processing scope when issuing shadow requests.
- Assign users or sessions to stable rollout groups to avoid frequent style changes within a conversation.
- Include error rates, latency, cost, and business quality in rollback criteria.