Agent402 / tools / v1-chat-metered-responses

Responses metered (OpenAI Responses API)

$0.001 per call · USDC via x402 · POST /v1/metered/responses

OpenAI Responses API billed per request from what the call costs: the 402 quotes exact-BPE input (instructions + input items + tools) plus your max_output_tokens at the model's list price, times 1.15, never under $0.001; an upto (Permit2) or credits buyer settles actual usage under that quote. Point the OpenAI SDK's responses.create(), the OpenAI Agents SDK, or OpenAI Codex CLI's model_providers base_url at https://agent402.tools/v1/metered. Any model the flat tiers serve (GET /v1/models); function tools only; store is always false.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
modelstringModel id (OpenRouter naming) - allowlisted per tier; omit (or "auto") on the auto tier
input *anyA string, or an array of input items ({role, content} messages with input_text / input_image parts, function_call, function_call_output)
instructionsstringOptional system/developer instructions
max_output_tokensintegerOptional output cap (clamped to the tier cap)
toolsarrayOptional function tools ({type:"function", name, parameters}); server-side tools are not served
textobjectOptional {format: {type: "text"|"json_schema"|"json_object", ...}}
reasoningobjectOptional {effort: "none"|"minimal"|"low"|"medium"|"high"|"xhigh"|"max"} - reasoning tokens count against max_output_tokens
streambooleanResponses SSE events (response.created … response.completed)
zdrbooleanOptional - zero-data-retention providers only

Example output

{
  "id": "resp_…",
  "object": "response",
  "status": "completed",
  "model": "openai/gpt-4o-mini",
  "output": [
    {
      "id": "msg_…",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "x402 is an HTTP-native way for agents to pay per request with USDC.",
          "annotations": []
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 14,
    "output_tokens": 18,
    "total_tokens": 32
  }
}

Try it - see the 402 challenge (free)

curl -i -X POST https://agent402.tools/v1/metered/responses \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-haiku-4.5","input":"Summarize x402 in one sentence.","max_output_tokens":128}'

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/metered/responses", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "model": "anthropic/claude-haiku-4.5",
    "input": "Summarize x402 in one sentence.",
    "max_output_tokens": 128
  }),
});
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 - metered (pay what the call costs)

$0.001 · POST /v1/metered/chat/completions

OpenAI-compatible chat completions billed per request from what the call costs: the 402 quotes exact-BPE input plus your…

try in playground →

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 →