{"slug":"agent402-tools-v1-metered-chat-completions-a74d3b","title":"OpenAI-compatible chat completions priced from the request itself","host":"agent402.tools","method":"POST","resource":"https://agent402.tools/v1/metered/chat/completions","category":"market","description":"OpenAI-compatible chat completions priced from the request itself: the 402 quotes this exact body, from $0.001, and a buyer on the upto scheme settles the tokens actually used under that quote. Use it when an agent sends large or variable prompts and wants to pay for what it sends, not a flat tier.","price_listed":0.001,"price_asked":null,"state":"effects","state_label":"Not tested: has real-world effects","checks_7d":0,"answered_7d":0,"latency_ms_median":null,"reported_calls_30d":140,"reported_payers_30d":4,"networks":["algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=","eip155:10","eip155:1329","eip155:137","eip155:143","eip155:42161","eip155:42220","eip155:43114","eip155:4663","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","stellar:pubnet"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"max_tokens":5,"messages":[{"content":"Reply with exactly: OK","role":"user"}],"model":"openai/gpt-4o-mini"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"properties":{"cache_control":{"description":"Optional - prompt caching preference. Default ON ({type:\"ephemeral\"}, 5-minute TTL): repeated prefixes across your turns are served from the provider cache (same price to you). Send false to disable. ttl:\"1h\" is not offered."},"max_completion_tokens":{"description":"Optional - alias of max_tokens (newer OpenAI SDKs send this).","type":"integer"},"max_tokens":{"description":"Output token cap (clamped to the tier maximum)","type":"number"},"messages":{"description":"OpenAI chat messages: [{role, content}] - text and image_url content blocks supported","type":"array"},"model":{"description":"Model id - OpenRouter form (openai/gpt-4o-mini) or bare OpenAI form (gpt-4o-mini). GET /v1/models lists the allowlist per tier. Optional: omit it and the tier serves its documented default (x402.defaultModel on /v1/models), named back in agent402_default_model; the price does not change","type":"string"},"reasoning":{"description":"Optional - {effort: \"none\"|\"minimal\"|\"low\"|\"medium\"|\"high\"|\"xhigh\"|\"max\", max_tokens?, exclude?, enabled?}. Reasoning tokens count against max_tokens. Omitted: low effort on the budget tiers, the model default on premium. reasoning_effort (string) is accepted as an alias.","type":"object"},"tools":{"description":"Optional - OpenAI function tools {type:\"function\", function:{...}}, or a tool namespace {type:\"namespace\", name, tools:[...]} (flattened into its functions). The pro and premium routes also accept the bounded server tools openrouter:web_search, openrouter:web_fetch and openrouter:datetime with server-owned limits (GET /v1/models lists them); stop_server_tools_when and max_tool_calls are refused. A request with a server tool is never served from the prompt cache.","type":"array"},"zdr":{"description":"Optional - true routes only to zero-data-retention providers (OpenRouter provider.zdr); the only provider preference a caller may set.","type":"boolean"}},"required":["messages"]},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"properties":{"choices":{"items":{"type":"object"},"type":"array"},"created":{"type":"integer"},"id":{"type":"string"},"model":{"type":"string"},"object":{"type":"string"},"usage":{"properties":{"completion_tokens":{"type":"integer"},"prompt_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}},"type":"object"}},"required":["id","object","created","model","choices","usage"],"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[],"description_full":"OpenAI-compatible chat completions priced from the request itself: the 402 quotes this exact body, from $0.001, and a buyer on the upto scheme settles the tokens actually used under that quote. Use it when an agent sends large or variable prompts and wants to pay for what it sends, not a flat tier.","last_updated":"2026-09-24T16:04:51.79Z","schemes":["exact","upto"]}