HTTP/1.1 402 PAYMENT REQUIRED · Agentic Finance (AIFI) · x402 + MPP dual-stack 500+ tools · 12 rails · 0% seller fee
Agent402 / tools / v1-chat-auto-messages

Messages auto (Anthropic-compatible)

$0.01 per call · USDC via x402 · POST /v1/auto/messages

Anthropic Messages API over x402 - point the Anthropic SDK (or Claude Code / the Agent SDK) at base_url https://agent402.tools/v1/auto and pay $0.01 per call in USDC, no API key, no signup. Same models, caps and price as this tier's /chat/completions route; any model here is served through the Messages wire (Claude natively, others translated). Up to 16,000 input chars and 1024 output tokens; streaming supported. Omit "model" and the gateway routes the prompt to the top-ranked model for its task type; the response adds agent402_router {category, quality, served}.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
modelstringModel id (OpenRouter naming, e.g. anthropic/claude-sonnet-5) - allowlisted per tier; omit (or "auto") on the auto tier
max_tokens *integerRequired by the Messages API; clamped to the tier's output cap
messages *arrayAnthropic messages: {role: user|assistant, content: string | [text|image|tool_use|tool_result blocks]}
systemstringOptional system prompt (string or text blocks)
toolsarrayOptional client tools {name, description, input_schema}; server/built-in tools are not served
thinkingobjectOptional {type:"enabled", budget_tokens} | {type:"adaptive"} | {type:"disabled"} - thinking tokens are output tokens
streambooleanAnthropic SSE (message_start … message_stop)
zdrbooleanOptional - zero-data-retention providers only

Example output

{
  "id": "msg_…",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-5",
  "content": [
    {
      "type": "text",
      "text": "x402 is an HTTP-native way for agents to pay per request with USDC."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 14,
    "output_tokens": 18
  }
}

Try it - see the 402 challenge (free)

curl -i -X POST https://agent402.tools/v1/auto/messages \
  -H "Content-Type: application/json" \
  -d '{"max_tokens":256,"messages":[{"role":"user","content":"Summarize x402 in one sentence."}]}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/v1/auto/messages", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "max_tokens": 256,
    "messages": [
      {
        "role": "user",
        "content": "Summarize x402 in one sentence."
      }
    ]
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Chat completions - nano tier

$0.003 · POST /v1/nano/chat/completions

OpenAI-compatible chat completions, nano tier: gpt-4.1-nano, gpt-5-nano, gemini flash-lite, small llama/ministral/qwen, …

try in playground →

Chat completions - auto tier (eval-ranked routing)

$0.01 · POST /v1/auto/chat/completions

OpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…

try in playground →

Grounded chat (web search, OpenAI-compatible)

$0.03 · POST /v1/grounded/chat/completions

OpenAI-compatible chat completions GROUNDED in a live web search on every call: the gateway runs an Exa search (up to 5 …

try in playground →