{"uid":"cap_jBOykN9fJPm7bzR5Ffae1","slug":"llm-model-router-cheapest-first-by-task-constraints-cd5e4a6b","name":"LLM Model Router — Cheapest-First by Task & Constraints","description":"Pick the cheapest LLM that passes your task and constraints. Give a task class and optional constraints such as minimum context, required tool-use, vision or reasoning, maximum input and output price per million tokens, a minimum coding benchmark and a provider filter, and get a ranked cheapest-first list of models that pass, plus a recommended pick and a deterministic rationale. Fused from open keyless catalogs LiteLLM, models dev and Aider with a citation on every model.","url":"https://api.agentstools.dev/model/route","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["task"],"properties":{"task":{"enum":["coding","reasoning","vision","tool-use","long-context","cheap-chat","general"],"type":"string","description":"The workload class to route for. Each class implies required capabilities and a sensible context floor that your explicit constraints override."},"provider":{"type":"string","description":"Optional provider filter such as anthropic or openai."},"min_context":{"type":"integer","minimum":0,"description":"Minimum context window in tokens."},"needs_tools":{"type":"boolean","description":"Require function or tool calling support."},"needs_vision":{"type":"boolean","description":"Require image or vision input support."},"min_benchmark":{"type":"number","maximum":100,"minimum":0,"description":"Minimum Aider coding pass rate percent."},"max_input_price":{"type":"number","minimum":0,"description":"Maximum input price in USD per million tokens."},"needs_reasoning":{"type":"boolean","description":"Require extended reasoning support."},"max_output_price":{"type":"number","minimum":0,"description":"Maximum output price in USD per million tokens."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ZWa4nIwCbBSUDnsXZ3i3P","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a ranked cheapest-first list of LLMs that satisfy a given task class and optional capability/price constraints, with a recommended pick and deterministic rationale.","exampleAgentPrompt":"I need the cheapest LLM that supports tool-use and vision, has at least 128k context, costs no more than $2 per million input tokens and $6 per million output tokens, and comes from Anthropic — route it for a general task and tell me which one to pick.","exampleUseCases":null,"resultDescription":"A ranked cheapest-first list of LLMs matching all supplied constraints, a single recommended pick, a deterministic rationale explaining the choice, and per-model citations sourced from LiteLLM, models.dev, and Aider catalogs including pricing and benchmark data.","failureModes":["No models match all constraints — returns empty ranked list or error indicating no match","Invalid task enum value — returns 400 validation error","min_benchmark out of 0–100 range — schema validation error","Contradictory constraints (e.g. needs_reasoning=true with very low max price) — returns empty results","Provider filter string not recognized — may return empty or unfiltered results"],"whenToPreferThis":"Use this endpoint when an AI agent needs to programmatically select the most cost-effective LLM for a specific workload class without manually querying multiple provider APIs. Ideal for dynamic routing in agentic pipelines where task type, capability requirements, and budget constraints vary per request. Prefer over static model hardcoding or manual comparison when cost optimization and capability filtering both matter.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:54:19.481Z","isFirstParty":false}