
I built an AI gateway that picks the right model for every request
Every AI app has the same problem: you hardcode model: "gpt-4o" and pay frontier prices for "what's the weather?" questions. I built Styx to fix this. It's an open-source AI gateway where you send "model": "styx:auto" and it picks the right model automatically. How it works When your app sends a request to Styx with model: "styx:auto", a 9-signal classifier scores the prompt in real-time: The 9 signals: Token count — Short vs long prompts Code presence — Code blocks, function/class/def keywords Reasoning patterns — "step by step", "analyze", "compare" Math markers — "prove", "equation", "calculate" Technical depth — "refactor", "architecture", "optimize" Creative scope — "write a story", "design a system" Conversation depth — Multi-turn conversations Multimodal hints — References to images, documents Language detection — Non-English content Score 0-29 → cheap model (gpt-4o-mini, $0.15/1M) Score 30-59 → balanced model (gpt-4o, $2.50/1M) Score 60+ → frontier model (gpt-5.4, $2.50/1M) The
Continue reading on Dev.to Webdev
Opens in a new tab




