Skip to content

Responses metered (Responses wire format)

quoted per request from $0.001USDC via x402POST /v1/metered/responses

OpenAI Responses API priced per request from the request itself. Send POST /v1/metered/responses with the required field input and pay quoted per request from $0.001 over x402 or MPP (there is no free tier). It returns a JSON object with id, object, status, model, output and 1 more.

The 402 quotes the input (instructions, input items and tools), estimated from its tokens with headroom, plus your max_output_tokens, 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. The default is anthropic/claude-haiku-5.5; a call that names no model and carries a parameter anthropic/claude-haiku-5.5 does not take (temperature, top_p, top_k, an assistant prefill or a fixed reasoning budget) is served by anthropic/claude-haiku-4.5.

Category: LLM gatewayTags: llm ai inference openai-compatible responses-api agents-sdk codex gateway

Try in playground →

Parameters

NameTypeRequiredDescription
modelstringnoModel id (OpenRouter naming) - allowlisted per tier; omit (or "auto") on the auto tier The example sends anthropic/claude-haiku-4.5.
inputanyyesA string, or an array of input items ({role, content} messages with input_text / input_image parts, function_call, function_call_output) Also accepted as data, str, string, body, content. The example sends Summarize x402 in one sentence..
instructionsstringnoOptional system/developer instructions
max_output_tokensintegernoOptional output cap (clamped to the tier cap)
toolsarraynoOptional function tools ({type:"function", name, parameters}); server-side tools are not served
textobjectnoOptional {format: {type: "text"|"json_schema"|"json_object", ...}}
reasoningobjectnoOptional {effort: "none"|"minimal"|"low"|"medium"|"high"|"xhigh"|"max"} - reasoning tokens count against max_output_tokens. An effort above low, or a reasoning.max_tokens budget, that leaves no room for an answer inside a small max_output_tokens is lowered before the call, and an answer that still comes back empty is retried once on the same model at its lowest supported effort when the call's price and time allow; either change is named in agent402_reasoning_adjusted {field, requested, used, reason} (the X-Agent402-Reasoning-Adjusted header on a stream)
streambooleannoResponses SSE events (response.created … response.completed)
zdrbooleannoOptional - zero-data-retention providers only

Example request

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."}'

Without payment this returns HTTP 402 Payment Required with the exact price for v1-chat-metered-responses; any x402 v2 or MPP client pays it and retries.

Watch a call get paid

RequestPOST /v1/metered/responses
402from $0.001 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "id": "resp_…",
  "object": "response",
  "status": "completed",
  "model": "openai/gpt-6-luna",
  "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
  }
}
FieldTypeAlways presentIn the example
idstringyesresp_…
objectstringyesresponse
statusstringyescompleted
modelstringyesopenai/gpt-6-luna
outputarray of objectsyes1 item in the example
usageobjectyes3 fields: input_tokens, output_tokens and 1 more

From an MCP client

catalog.call {
  "slug": "v1-chat-metered-responses",
  "params": {
    "model": "anthropic/claude-haiku-4.5",
    "input": "Summarize x402 in one sentence."
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for v1-chat-metered-responses; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.17.1.

Errors and behavior

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();
client.setSpendControls?.({ maxAmountPerPayment: "$2.00" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_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."
  }),
});

No wallet yet? Fund a first one with USDC on Base, no ETH needed, or run npx -y agent402-mcp@0.17.1 wallet new to make one on this computer: it stores the key and prints the address and the config, never the key.

The quote (Python)

Standard library only: the 402 and the price its PAYMENT-REQUIRED header quotes on each chain. To pay from Python, sign it with any x402 client.

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/v1/metered/responses", method="POST", data="{\"model\":\"anthropic/claude-haiku-4.5\",\"input\":\"Summarize x402 in one sentence.\"}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Related tools

Responses auto (Responses wire format)

$0.01POST /v1/auto/responses

Responses-format chat over x402, compatible with the OpenAI Responses wire format: point the OpenAI SDK's.

Chat completions - metered (pay what the call costs)

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

OpenAI-compatible chat completions priced per request from the request itself.

Responses nano (Responses wire format)

from $0.003POST /v1/nano/responses

Responses-format chat over x402, compatible with the OpenAI Responses wire format: point the OpenAI SDK's.

Responses premium (Responses wire format)

$0.50POST /v1/premium/responses

Responses-format chat over x402, compatible with the OpenAI Responses wire format: point the OpenAI SDK's.

Responses pro (Responses wire format)

from $0.10POST /v1/pro/responses

Responses-format chat over x402, compatible with the OpenAI Responses wire format: point the OpenAI SDK's.

Responses base (Responses wire format)

from $0.02POST /v1/responses

Responses-format chat over x402, compatible with the OpenAI Responses wire format: point the OpenAI SDK's.