model-router

Routes chat queries to the most suitable Azure OpenAI model to minimize cost.

Updated Jan 15, 2026
One-click install
npx skills add https://github.com/samelhousseini/microhacks --skill model-router
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-router
Source: https://github.com/samelhousseini/microhacks/tree/main/.github/skills/model-router
Command: npx skills add https://github.com/samelhousseini/microhacks --skill model-router

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openai, and includes scripts (resource) components.

What problem does it solve?

Building cost-efficient chat applications requires routing user queries to the most suitable underlying Azure OpenAI model, reducing spend while maintaining answer quality.

Core Features & Use Cases

  • Auto-routing: Directs prompts to the optimal model tier based on complexity.
  • Cost tracking: Logs token usage and per-request costs for transparency.
  • Model visibility: Returns the underlying model used for each request and supports multiple routing modes (balanced, cost, quality).
  • Use Case: Integrate with a customer support chatbot to route simple FAQs to nano/mini models and complex queries to higher-tier deployments, achieving significant savings.

Quick Start

Install dependencies from requirements.txt, configure Azure credentials, and instantiate the Model Router client. Then call simple_query with example prompts to observe routing decisions and cost reporting.

Frequently Asked Questions about model-router

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route chat queries to different Azure OpenAI models to minimize cost?

Route chat queries by using a Python client library that evaluates prompt complexity and directs each request to the optimal Azure OpenAI model tier, minimizing spend while maintaining answer quality.

How does token usage tracking work for OpenAI API requests?

Token usage tracking logs token counts and per-request costs for transparency. The router returns the underlying model used for each request and provides routing analytics for custom backends.

Can I use Python to send simple FAQs to mini models and complex queries to higher-tier deployments?

Yes, you can integrate the Python client library into a customer support chatbot to route simple FAQs to nano or mini models and complex queries to higher-tier deployments, achieving significant savings.

What routing modes are available for optimizing Azure OpenAI query costs?

Available routing modes include balanced, cost, and quality. These modes allow you to prioritize between overall balance, maximum cost reduction, or higher answer quality when routing chat queries.

Do I need the openai Python package to use model routing with Azure OpenAI?

Yes, the openai package is a required dependency. You must install dependencies from requirements.txt, configure Azure credentials, and instantiate the Model Router client to observe routing decisions.