Chat Completions
by Chat completions - premium tier in AI models & inference
OpenAI-compatible chat completions, premium tier: gpt-5, gpt-6 astra, o3 and o4-mini, claude opus, claude fable 5.1 - paid per call in USDC over x402. Same wire format as /v1/chat/completions with the largest caps (85k chars in, 8192 tokens out).
https://agent402.tools/v1/premium/chat/completions- Price
- $0.5
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 317 ms
- 421 ms slowest 5%
- Last check
- Passed
- 1 h ago, next in 5 h
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://agent402.tools/v1/premium/chat/completions
Each call costs $0.5 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://agent402.tools/v1/premium/chat/completions
content-type: application/json
{
"max_tokens": 5,
"messages": [
{
"content": "Reply with exactly: OK",
"role": "user"
}
],
"model": "anthropic/claude-opus-4"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cache_control | any | No | 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 | integer | No | Optional - alias of max_tokens (newer OpenAI SDKs send this). |
max_tokens | number | No | Output token cap (clamped to the tier maximum) |
messages | array | Yes | OpenAI chat messages: [{role, content}] - text and image_url content blocks supported |
model | string | Yes | 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 |
reasoning | object | No | 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. |
tools | array | No | 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 serv… |
zdr | boolean | No | Optional - true routes only to zero-data-retention providers (OpenRouter provider.zdr); the only provider preference a caller may set. |
Example response
The provider's example. We can't check it without paying.
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "OK",
"role": "assistant"
}
}
],
"created": 1750000000,
"id": "gen-…",
"model": "anthropic/claude-opus-4",
"object": "chat.completion",
"usage": {
"completion_tokens": 1,
"prompt_tokens": 12,
"total_tokens": 13
}
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.5.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://agent402.tools/v1/premium/chat/completions' \
-H 'content-type: application/json' \
--data-raw '{"max_tokens":5,"messages":[{"content":"Reply with exactly: OK","role":"user"}],"model":"anthropic/claude-opus-4"}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://agent402.tools/v1/premium/chat/completions' \
-H 'content-type: application/json' \
--data-raw '{"max_tokens":5,"messages":[{"content":"Reply with exactly: OK","role":"user"}],"model":"anthropic/claude-opus-4"}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.5 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.5" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.5 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fv1%2Fpremium%2Fchat%2Fcompletions&method=POST
const res = await pay("https://agent402.tools/v1/premium/chat/completions", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"max_tokens": 5,
"messages": [
{
"content": "Reply with exactly: OK",
"role": "user"
}
],
"model": "anthropic/claude-opus-4"
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.5 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.5"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://agent402.tools/v1/premium/chat/completions",
json={
"max_tokens": 5,
"messages": [
{
"content": "Reply with exactly: OK",
"role": "user",
},
],
"model": "anthropic/claude-opus-4",
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 1 h ago | Passed | 402 | 195 ms | $0.5 |
| 11 h ago | Passed | 402 | 262 ms | $0.5 |
| 21 h ago | Passed | 402 | 194 ms | $0.5 |
| 31 h ago | Passed | 402 | 190 ms | $0.5 |
| 40 h ago | Passed | 402 | 347 ms | $0.5 |
Show 10 older checks
| 2 days ago | Passed | 402 | 528 ms | $0.5 |
| 2 days ago | Passed | 402 | 184 ms | $0.5 |
| 3 days ago | Passed | 402 | 328 ms | $0.5 |
| 3 days ago | Passed | 402 | 189 ms | $0.5 |
| 4 days ago | Passed | 402 | 259 ms | $0.5 |
| 4 days ago | Passed | 402 | 604 ms | $0.5 |
| 4 days ago | Passed | 402 | 288 ms | $0.5 |
| 4 days ago | Passed | 402 | 346 ms | $0.5 |
| 5 days ago | Passed | 402 | 322 ms | $0.5 |
| 5 days ago | Passed | 402 | 298 ms | $0.5 |