This prompt is for infrastructure engineers building model routers that must select the optimal model per request. The job-to-be-done is not simple intent classification; it's a reasoned dispatch decision that weighs a user's unstructured input against a defined pool of models, each with different cost, latency, and capability profiles. The ideal user is an AI platform engineer who already has a model pool with defined capabilities and needs the router to make a trade-off decision, not just a keyword match. You should use this prompt when the routing logic requires understanding the complexity, domain, and constraints of a request to map it to the best-fit model.
Prompt
Model-Selection Intent Prompt for Router Systems

When to Use This Prompt
Defines the precise job-to-be-done, the ideal user, and the operational boundaries for the model-selection intent prompt.
Do not use this prompt for simple intent classification that maps to a single downstream workflow, like a basic support ticket router that sends all 'billing' questions to one queue. This prompt is overkill if your system dispatches work to a single model or if the routing decision is a static lookup. It assumes you have a multi-model architecture and that the routing decision requires reasoning about trade-offs. Before implementing, you must have a well-defined model pool with documented capabilities, cost profiles, and latency characteristics. The prompt's value is in its ability to articulate why a specific model was chosen, providing a routing rationale that is auditable and debuggable.
To get started, define your model pool as a structured input to the prompt, including each model's strengths, weaknesses, and constraints. Then, integrate this prompt into your request pipeline before model invocation. The next section provides the copy-ready template. After adapting it, you'll need to build a validation harness to ensure the selected model is actually in your pool and that the rationale is coherent. For high-stakes routing, always log the full prompt and response for offline evaluation and A/B testing against alternative routing strategies.
Use Case Fit
This prompt is designed for infrastructure engineers building model routers. It maps user intent to a specific model identifier with a routing rationale. It is not a general-purpose chatbot prompt or a direct user-facing response generator.
Good Fit: Cost-Optimized Model Pools
Use when: You maintain a pool of models with different cost and capability profiles and need to route each request to the cheapest model that can handle the intent. Guardrail: Always inject a cost and latency budget into the prompt context so the router weighs economics against capability.
Bad Fit: Single-Model Deployments
Avoid when: Your application uses only one model for all requests. The routing overhead adds latency and complexity with no benefit. Guardrail: Use a simple intent classifier without model selection logic, or route directly based on hardcoded rules.
Required Input: Model Catalog with Capabilities
What to watch: The router cannot make informed decisions without a current, structured catalog of available models, their strengths, and their constraints. Guardrail: Provide a JSON schema for the model catalog and validate it before injection. Stale catalogs cause routing to deprecated or overloaded models.
Operational Risk: Routing Rationale Opacity
What to watch: A model identifier without a traceable rationale makes debugging misroutes impossible. Guardrail: Require the prompt to output a routing_rationale field. Log this alongside the selected model for every request to enable A/B comparison and cost auditing.
Operational Risk: Budget Overrun Cascades
What to watch: If the router ignores cost or latency budgets, a single misclassified request can consume the resources of ten normal requests. Guardrail: Implement a circuit breaker in the application harness. If the selected model exceeds the budget, fall back to a cheaper default model and flag the incident.
Bad Fit: Real-Time User-Facing Chat
Avoid when: The prompt's output is shown directly to end users. The model identifier and rationale are internal infrastructure signals, not user messages. Guardrail: This prompt must sit in middleware. The user should only see the final response from the selected downstream model.
Copy-Ready Prompt Template
A reusable prompt template for classifying user requests and selecting the optimal model, complete with routing rationale and cost-latency constraints.
This template is the core instruction set for a model router. It takes a user request, a catalog of available models with their capabilities and cost profiles, and a set of operational constraints, then outputs a structured routing decision. The prompt is designed to be injected into a system prompt for a fast, inexpensive classifier model (the 'router') that sits in front of a pool of more powerful, specialized models. The square-bracket placeholders must be populated by your application logic before the prompt is sent to the router model.
textYou are a model-selection router. Your task is to analyze the user's request and select the most appropriate model from the available catalog to handle it. You must balance capability requirements, cost, and latency. ## AVAILABLE MODEL CATALOG [MODEL_CATALOG] ## OPERATIONAL CONSTRAINTS - Maximum cost budget per request: [COST_BUDGET] - Maximum latency target (ms): [LATENCY_BUDGET] - Default model for out-of-scope requests: [DEFAULT_MODEL] ## USER REQUEST [USER_INPUT] ## INSTRUCTIONS 1. Analyze the user's request to determine the required capabilities (e.g., reasoning complexity, domain expertise, tool use, multimodality). 2. Select the single best model from the catalog that meets all requirements and stays within the operational constraints. 3. If no model is suitable, or the request is out of scope, select the default model and set the `abstain` flag to `true`. 4. Provide a concise, evidence-based rationale for your selection. ## OUTPUT SCHEMA You must respond with a single, valid JSON object conforming to this schema: { "model_id": "string", "rationale": "string", "abstain": false, "estimated_cost": "number", "estimated_latency_ms": "number" }
To adapt this template, replace [MODEL_CATALOG] with a structured list of your available models. This list should be a clear, text-based representation of a JSON array, including fields like id, description, strengths, cost_per_1k_tokens, and avg_latency_ms. The [COST_BUDGET] and [LATENCY_BUDGET] placeholders should be replaced with numeric values representing your application's hard limits. The [USER_INPUT] is the raw, unmodified text from the end-user. Before deploying, validate that the router model reliably produces JSON conforming to the output schema. Implement a post-processing step in your harness to parse the JSON, check the abstain flag, and route the [USER_INPUT] to the model specified by model_id. If the router's output fails schema validation, your harness should fall back to the [DEFAULT_MODEL] and log the failure for debugging.
Prompt Variables
Required inputs for the Model-Selection Intent Prompt. Each placeholder must be populated before inference. Validation notes describe how to verify the input is well-formed and safe to inject.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_REQUEST] | The raw, unstructured user input that needs a model assigned to handle it. | Explain the trade-offs between gRPC and REST for internal service communication. | Non-empty string. Check for prompt injection patterns before injection. Max length enforced by context budget. |
[MODEL_CATALOG] | A structured list of available models with their capabilities, cost profiles, and latency characteristics. | [ {"id": "claude-opus", "strengths": ["complex reasoning", "long context"], "cost_per_1k_tokens": 0.015}, {"id": "gpt-4o-mini", "strengths": ["simple tasks", "low latency"], "cost_per_1k_tokens": 0.00015} ] | Must be valid JSON array. Each entry requires id, strengths, and cost_per_1k_tokens fields. Schema validation before injection. Empty catalog triggers fallback routing. |
[COST_BUDGET_USD] | Maximum acceptable cost for this request in US dollars. | 0.005 | Positive float. Null allowed if cost is unconstrained. If set, router must select a model whose estimated cost does not exceed this value. |
[LATENCY_BUDGET_MS] | Maximum acceptable end-to-end latency in milliseconds. | 2000 | Positive integer. Null allowed if latency is unconstrained. If set, router must select a model whose p95 latency does not exceed this value. |
[DOMAIN_HINT] | Optional domain context to bias model selection toward specialized capabilities. | backend-engineering | String or null. Must match an entry in the allowed domain taxonomy if provided. Invalid values logged and ignored rather than causing routing failure. |
[REQUIRED_CAPABILITIES] | Hard constraints on model capabilities that must be satisfied. | ["function-calling", "json-mode"] | Array of strings or null. Each entry must match a capability tag in the model catalog. Request fails fast if no model satisfies all required capabilities. |
[ROUTING_HISTORY] | Recent routing decisions and their outcomes for this session or user, used to avoid repeating failed model selections. | [{"request_id": "req-001", "model_selected": "gpt-4o", "outcome": "success", "latency_ms": 1800}] | Array of objects or null. Each entry requires model_selected and outcome fields. Used for A/B comparison and fallback logic. Truncate to last N entries to stay within context budget. |
Implementation Harness Notes
How to wire the model-selection intent prompt into a production router with validation, cost enforcement, and fallback logic.
This prompt is designed to be the decision layer inside a model router, not a standalone chatbot. The application harness must receive the structured JSON output, validate it against the available model pool, enforce cost and latency budgets, and then dispatch the request to the selected model. The prompt itself does not execute the routing; it produces a routing recommendation that your application code must verify and act on. Treat the prompt output as an advisory decision that requires runtime validation before any model invocation occurs.
The implementation flow should follow a strict sequence: (1) assemble the prompt with the user's input, the available model catalog including capabilities and cost profiles, and the current latency budget; (2) call a fast, low-cost model to execute this classification prompt; (3) parse the JSON output and validate that the model_identifier exists in the active model pool and is currently healthy; (4) check that the estimated cost and latency from the routing rationale do not exceed the configured budget; (5) if validation passes, dispatch the original user input to the selected model; (6) if validation fails, fall back to a default model or escalate to a human operator. Log every routing decision with the full prompt output, validation result, and fallback reason for later analysis.
For production deployment, implement a retry policy on the classification step itself: if the classification model returns malformed JSON or a model identifier that fails validation, retry once with a stricter output format instruction before falling back. Add a circuit breaker that routes all traffic to a default model if the classification step exceeds a latency threshold (e.g., 200ms) or error rate (e.g., 5% over a rolling window). Instrument the harness to emit metrics on classification accuracy, routing latency, cost-per-request, and fallback rate. Run A/B comparisons by splitting traffic between the routed model selection and a baseline model to measure whether the router actually improves quality, cost, or latency relative to a static default. The routing rationale field is your primary debugging artifact when a routing decision looks wrong in production traces.
Expected Output Contract
Schema contract for the model-selection router output. Every field must be validated before the routing decision is executed. Missing or malformed fields should trigger a retry or fallback to a default model.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
selected_model_id | string | Must match an entry in the [MODEL_CATALOG] list. Reject if not found. | |
routing_rationale | string | Must be non-empty and contain at least one reference to [INPUT_INTENT] or [CONSTRAINTS]. | |
complexity_score | number (0.0-1.0) | Must be a float between 0.0 and 1.0. Reject if out of range or non-numeric. | |
estimated_latency_ms | integer | Must be a positive integer. Reject if > [MAX_LATENCY_BUDGET_MS]. | |
estimated_cost_credits | number | Must be a positive float. Reject if > [MAX_COST_BUDGET_CREDITS]. | |
alternative_model_id | string | If present, must match an entry in [MODEL_CATALOG]. Null allowed. | |
ab_test_group | string | If present, must match a key in [AB_TEST_CONFIG]. Null allowed. | |
fallback_triggered | boolean | Must be true if selected_model_id is the [DEFAULT_FALLBACK_MODEL], else false. |
Common Failure Modes
Model-selection routers fail silently and expensively. These are the most common production failure patterns and the specific guardrails that catch them before they cost you.
Cost-Optimized Routing to Overqualified Models
What to watch: The router sends simple, low-complexity requests to expensive frontier models because the intent prompt lacks cost-awareness. A 'summarize this paragraph' request lands on a large reasoning model, burning budget with zero quality gain. Guardrail: Add a max_model_tier constraint to the prompt based on intent complexity. Simple intents (summarization, extraction, translation) should map to tier: basic. Reserve tier: premium for multi-step reasoning, code generation, or ambiguous analysis.
Latency-Budget Violation Under Load
What to watch: The router selects a slow, high-quality model for a request that required sub-second response. The prompt optimizes for accuracy alone, ignoring the latency SLA attached to the request context. Guardrail: Include a latency_budget_ms field in the router prompt input. Add an explicit instruction: 'If the selected model's typical latency exceeds the budget, downgrade to the fastest model that meets the minimum quality threshold or route to a pre-warmed cache.'
Domain Misclassification Causing Tool Dispatch Failures
What to watch: A legal contract review request is classified as general document Q&A. The router selects a model without legal-domain fine-tuning, and downstream tool calls fail because the legal-specific tools were never loaded. Guardrail: Require the prompt to output a domain label before selecting a model. Map domains to approved model pools. If the domain confidence is below threshold, route to a generalist model with a missing_domain_tools flag that triggers a human review queue instead of silent failure.
Ambiguous Intent Causing Model Ping-Pong
What to watch: The input matches multiple intents with similar confidence. The router picks one arbitrarily, the model response is inadequate, and the system retries with a different model. This creates a silent retry loop that burns tokens and latency. Guardrail: Add an ambiguity_score output field. When ambiguity exceeds a threshold, the router must either select a general-purpose model with explicit clarification instructions or escalate to a human dispatcher. Never allow the router to guess between two equally likely intents without a tiebreaker rule.
Model Deprecation Without Router Updates
What to watch: A model identifier hardcoded in the router prompt is deprecated by the provider. The router continues selecting it, causing API errors or silent fallback to an unintended default model. Guardrail: Never hardcode model IDs in the prompt. Use abstract model capability labels (reasoning-heavy, latency-optimized, multilingual). Maintain an external model registry that maps capability labels to concrete model IDs. Add a pre-flight check that validates selected model IDs against the registry before invocation.
Context Window Overflow from Unbounded Input
What to watch: The router prompt receives a massive input (full document, long conversation history) and selects a model with a context window too small to process it. The request fails after the routing decision is already made, wasting the routing call and requiring a retry. Guardrail: Add a pre-routing token count check. If the input exceeds the target model's context window, the router must either select a long-context model, trigger a chunking preprocessor, or return an error before the model call. Include estimated_input_tokens as a required field in the routing decision output.
Evaluation Rubric
Use this rubric to evaluate the Model-Selection Intent Prompt before production deployment. Each criterion targets a specific failure mode common in model routing systems.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Model Identifier Validity | Output contains a model identifier that exists in the provided [MODEL_POOL] catalog. | Hallucinated model name or identifier not present in the allowed pool. | Schema check: parse output and assert model_id is in the provided model list. |
Routing Rationale Quality | Rationale references specific input characteristics (complexity, domain, constraints) and maps them to model capabilities. | Rationale is generic, circular, or missing (e.g., 'chose this model because it is best'). | LLM-as-judge: evaluate rationale against a rubric requiring evidence from [INPUT] and [MODEL_POOL]. |
Constraint Adherence | Selected model respects explicit [CONSTRAINTS] such as max latency budget, max cost per token, or required feature support. | Selected model violates a hard constraint (e.g., cost exceeds budget, latency exceeds SLA). | Unit test: run prompt with constraint-violating inputs and assert output model meets all constraints. |
Abstention on Out-of-Scope | Returns a defined abstention value (e.g., 'none') when no model in [MODEL_POOL] satisfies the request. | Selects a model despite it being unsuitable, or returns an unparseable null value. | Test with deliberately impossible constraints; assert output matches the abstention token defined in [OUTPUT_SCHEMA]. |
Output Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present. | Malformed JSON, missing required fields, or extra fields not in the schema. | Automated validation: parse output with a JSON schema validator configured with [OUTPUT_SCHEMA]. |
Cost/Latency Budget Enforcement | The selected model's cost and latency profile, as defined in [MODEL_POOL], is within the [CONSTRAINTS] budget. | Model cost or latency exceeds the budget specified in the prompt variables. | Parameterized test: run across a matrix of budget values and assert selected model profile is within bounds. |
A/B Comparison Consistency | When [COMPARISON_MODE] is true, output includes a secondary model choice with a comparative rationale. | Secondary choice is missing, identical to primary without justification, or rationale is contradictory. | Test with comparison mode enabled; assert output contains both primary and secondary choices with distinct rationales. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a hardcoded model catalog. Replace the dynamic [MODEL_CATALOG] placeholder with a static JSON array of 3–5 models. Remove cost and latency budget enforcement; focus only on intent-to-model mapping accuracy. Use a simple pass/fail eval: does the router pick a reasonable model for 20 hand-labeled examples?
Watch for
- Overfitting to the small static catalog—routing logic won't generalize when you add models later
- No confidence threshold, so every request gets a model even when intent is ambiguous
- Missing rationale in output makes debugging impossible

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us