🚀 Everything is free — help us improve! Submit feedback and shape the platform.
LLM Gateways/M-058Build an Intelligent Model Router📖 Guide🏅Rank 06· The Distiller
🧪TDD Challenge·beginner·⏱️ 20–35m·125 XP

M-058Build an Intelligent Model Router

Description

Nebula Corp's AI platform sends every request to GPT-4o, costing a fortune. Most requests are simple FAQ lookups that a cheaper model could handle. Build an intelligent router that classifies request complexity and routes to the appropriate model tier: 'fast' (cheap model for simple tasks), 'balanced' (mid-tier for moderate tasks), or 'powerful' (expensive model for complex reasoning). The router should analyze the user message and return the correct model name.

Test Cases (3)

Simple greeting routes to fast
Greetings should use the cheapest model
Input:routeRequest('Hello!')
Expected:CONTAINS:mini
Complex task routes to powerful
Complex tasks should use the most capable model
Input:routeRequest('Design a database schema')
Expected:CONTAINS:gpt-4o
Moderate task routes to balanced
Moderate tasks should use the balanced model
Input:routeRequest('Explain how promises work')
Expected:CONTAINS:claude

Related Lessons

Click Run / Check to validate your solution