# LLM Model Router — Cheapest-First by Task & Constraints

> LLM Model Router — Cheapest-First by Task & Constraints is a paid API for AI agents from api.agentstools.dev, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

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.

## Facts

- Endpoint: GET https://api.agentstools.dev/model/route
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/llm-model-router-cheapest-first-by-task-constraints-cd5e4a6b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_jBOykN9fJPm7bzR5Ffae1

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability llm-model-router-cheapest-first-by-task-constraints-cd5e4a6b
```

Example prompt: 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.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/llm-model-router-cheapest-first-by-task-constraints-cd5e4a6b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.agentstools.dev](https://www.zero.xyz/host/api.agentstools.dev/llms.txt)
