Responses metered (OpenAI Responses API)
POST /v1/metered/responsesOpenAI 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.
Input
| Field | Type | Description |
|---|---|---|
model | string | Model id (OpenRouter naming) - allowlisted per tier; omit (or "auto") on the auto tier |
input * | any | A string, or an array of input items ({role, content} messages with input_text / input_image parts, function_call, function_call_output) |
instructions | string | Optional system/developer instructions |
max_output_tokens | integer | Optional output cap (clamped to the tier cap) |
tools | array | Optional function tools ({type:"function", name, parameters}); server-side tools are not served |
text | object | Optional {format: {type: "text"|"json_schema"|"json_object", ...}} |
reasoning | object | Optional {effort: "none"|"minimal"|"low"|"medium"|"high"|"xhigh"|"max"} - reasoning tokens count against max_output_tokens |
stream | boolean | Responses SSE events (response.created … response.completed) |
zdr | boolean | Optional - 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
}),
});
Related tools
Chat completions - metered (pay what the call costs)
POST /v1/metered/chat/completionsOpenAI-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
POST /v1/nano/chat/completionsOpenAI-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)
POST /v1/auto/chat/completionsOpenAI-compatible chat completions with server-side model choice: omit "model" (or send "auto") and the gateway routes t…
try in playground →