# POST /ai/models/pick: $0.01 per call

Cheapest AI model that can do your job. Describe the task (or list needed features: tools, json, reasoning, vision...), expected input/output tokens and a quality level (budget/balanced/best); get the cheapest suitable models across all major providers with estimated USD cost per call and per 1,000 calls, from live prices. POST {task, inputTokens, outputTokens}.

- **Price:** $0.01 in USDC, the same on Base, Solana, Polygon, Arbitrum. Failed calls are never charged.
- **Free trial:** yes, 20 free calls a day from Claude, Cursor or any MCP client ([set-up](/mcp/setup)).
- **Tier:** deep
- **Answers cached for:** 15 min
- **Data sources:** OpenRouter public model list (free); Workers AI (metered, only when a task is described)
- **Lane:** AI coding agents ([OpenAPI](/openapi/coding.json))
- **Live health:** [status page](/status)

## Free sample

See an answer for the demo input first, free (no payment, 10 a minute): [https://aayatai.com/sample/ai-models-pick](/sample/ai-models-pick). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

```bash
curl "https://aayatai.com/sample/ai-models-pick"
```

## 1. See the price (free)

Call it without paying: you get `402 Payment Required` and a `PAYMENT-REQUIRED` header with the exact price and where to pay.

```bash
curl -i -X POST https://aayatai.com/ai/models/pick -H "content-type: application/json" -d '{"task":"Extract invoice fields from scanned PDF images into JSON","inputTokens":3000,"outputTokens":400}'
```

## 2. Pay and call (TypeScript)

```bash
npm install @x402/fetch @x402/evm viem
```

```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

// A wallet used only by your agent, holding a little USDC on Base.
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

const res = await pay("https://aayatai.com/ai/models/pick", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"task":"Extract invoice fields from scanned PDF images into JSON","inputTokens":3000,"outputTokens":400}),
});
console.log(await res.json());
```

## 3. Or as an MCP tool

```ts
// MCP server: https://aayatai.com/mcp (Streamable HTTP). With the x402 MCP client (see /start):
const result = await client.callTool("ai-models-pick", {"task":"Extract invoice fields from scanned PDF images into JSON","inputTokens":3000,"outputTokens":400});
```

## Inputs

- `task` (string): What the model must do, in plain words. An AI reads it to work out the needed features and quality.
- `needs` (string): Comma list of required features (added to any the task implies): tools, json, reasoning, vision, audio, files, web-search.
- `inputTokens` (integer; default `2000`): Typical input (prompt) tokens per call.
- `outputTokens` (integer; default `500`): Typical output tokens per call.
- `minContext` (integer): Minimum context window (default: input + output tokens).
- `quality` (string; one of `budget`, `balanced`, `best`; default `balanced`): budget, balanced or best. If a task is given, the AI's judgement is used unless you set this to something other than balanced.
- `providers` (string): Only these providers, comma separated (e.g. anthropic,openai).
- `includeFree` (boolean; default `false`): Include free, rate-limited variants.
- `limit` (integer; default `10`): How many ranked models to return.

Bad inputs are rejected with HTTP 400 before any payment is asked for.

## Example answer

```json
{
  "requirements": {
    "needs": [
      "json",
      "vision"
    ],
    "quality": "balanced",
    "inputTokens": 3000,
    "outputTokens": 400,
    "minContext": 3400,
    "reason": "Reads images and returns structured data."
  },
  "recommended": {
    "id": "google/gemini-2.5-flash",
    "name": "Google: Gemini 2.5 Flash",
    "provider": "google",
    "contextLength": 1048576,
    "maxOutputTokens": 65535,
    "inputPerMTok": 0.3,
    "outputPerMTok": 2.5,
    "cachedInputPerMTok": 0.075,
    "perRequestUsd": 0,
    "free": false,
    "inputModalities": [
      "text",
      "image",
      "file",
      "audio"
    ],
    "features": [
      "tools",
      "json",
      "reasoning",
      "vision",
      "audio",
      "files"
    ],
    "created": "2025-06-17",
    "knowledgeCutoff": null,
    "estimatedCostPerCallUsd": 0.0019,
    "estimatedCostPer1000CallsUsd": 1.9
  },
  "candidates": [
    {
      "id": "google/gemini-2.5-flash",
      "name": "Google: Gemini 2.5 Flash",
      "provider": "google",
      "contextLength": 1048576,
      "maxOutputTokens": 65535,
      "inputPerMTok": 0.3,
      "outputPerMTok": 2.5,
      "cachedInputPerMTok": 0.075,
      "perRequestUsd": 0,
      "free": false,
      "inputModalities": [
        "text",
        "image",
        "file",
        "audio"
      ],
      "features": [
        "tools",
        "json",
        "reasoning",
        "vision",
        "audio",
        "files"
      ],
      "created": "2025-06-17",
      "knowledgeCutoff": null,
      "estimatedCostPerCallUsd": 0.0019
    }
  ],
  "considered": 458,
  "method": "Hard filters (features, context, output limit, provider), a price-based quality floor, then cheapest estimated cost per call.",
  "source": "OpenRouter",
  "fetchedAt": "2026-09-28T12:00:00.000Z"
}
```

## Related

- [GET /docs/find](/services/docs-find) ($0.003): Find the AI-ready docs for any library or API: checks the project's docs site (from its npm, PyPI, crates or Go metadata) or any company domain (docs., develope
- [GET /docs/lib](/services/docs-lib) ($0.005): Up-to-date docs for any npm, PyPI, crates or Go library, trimmed for a coding agent's context: finds the project's own llms.txt and docs pages (or the latest re
- [POST /docs/answer](/services/docs-answer) ($0.02): Ask a coding question about any npm, PyPI, crates or Go library and get an answer written only from its current docs (project llms.txt, docs pages or latest REA
- [GET /openapi](/services/openapi) ($0.005): Understand any public API fast: give its OpenAPI/Swagger spec URL, its docs or base URL, or a name from the APIs.guru directory (?api=stripe.com); we find the s
- [GET /library/research](/services/library-research) ($0.10): Premium research report on a library or API for coding agents: reads its current docs for your goal, checks version, safety and repository health, gathers what 
- [GET /package/check](/services/package-check) ($0.005): Should a coding agent install this package?
- [GET /dependency/verdict](/services/dependency-verdict) ($0.03): "Should I use this dependency?" in one call for npm, PyPI, crates or Go: full package safety check (vulnerabilities, malware, typosquats, deprecation, licence, 
- [GET /dependency/report](/services/dependency-report) ($0.08): Premium "should I use this dependency?" report: package safety (vulnerabilities, malware, typosquats, deprecation), GitHub repository health, licence compatibil

New here? [Getting started in 60 seconds](/start). All services: [Aayat AI](/).