# agent402.tools Chat Completions (x402 Pay-Per-Call)

> agent402.tools Chat Completions (x402 Pay-Per-Call) is a paid API for AI agents from agent402.tools, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

OpenAI-compatible chat completions endpoint that accepts requests via the OpenAI SDK format and charges per call in USDC over the x402 payment protocol — no API key or signup required.

## Facts

- Endpoint: POST https://agent402.tools/v1/chat/completions
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-chat-completions-x402-pay-per-call-a2a50c28
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_vzw9c_4i85i84xx84lhja

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-chat-completions-x402-pay-per-call-a2a50c28 -d '<json body>'
```

Example prompt: Send this conversation to gpt-4o-mini and get a reply — I want to pay per call in USDC, no API key: messages are [{"role":"user","content":"Summarize the French Revolution in 3 bullet points"}], cap the output at 300 tokens.

## When to prefer this

Choose this endpoint when you need OpenAI-SDK-compatible chat completions but want to pay per call in USDC via x402 rather than managing API keys or subscriptions. It is ideal for agents operating on crypto-native payment rails (Base, Solana, Polygon, Arbitrum, Stellar), serverless or wallet-authenticated workflows, or when you want budget model access (gpt-4o-mini, Claude Haiku, Gemini Flash) without committing to a monthly plan. Prefer it over the auto-routing sibling endpoint when you want explicit model control.

## Known failure modes

- Payment insufficient or x402 handshake fails — upstream returns 402 with a payment-required header
- Model ID not on the allowed tier allowlist — returns an error listing valid model IDs
- ZDR requested but no zero-data-retention provider available for the chosen model — walks failover chain and may error
- max_tokens exceeds tier maximum — clamped silently or rejected
- Provider upstream timeout or outage — error propagated from OpenRouter

## How this service works

OpenAI-compatible chat completions over x402 - point any OpenAI SDK at base_url https://agent402.tools/v1 and pay per call in USDC (Base, Solana, Polygon, Arbitrum, Stellar), no API key, no signup. Budget/mid models: gpt-4o-mini, claude haiku, gemini flash, deepseek, llama, mistral, qwen. Full wire compatibility incl. tools/function-calling and response_format. GET /v1/models lists every model. Streaming supported (stream: true).

## Output

An OpenAI-compatible chat completion object containing the assistant's reply message, finish reason, and token usage counts (prompt, completion, total). The response mirrors the standard OpenAI /v1/chat/completions response schema.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "zdr": {
   "type": "boolean",
   "description": "Optional - true routes only to zero-data-retention providers (OpenRouter provider.zdr); the only provider preference a caller may set."
  },
  "model": {
   "type": "string",
   "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"
  },
  "tools": {
   "type": "array",
   "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."
  },
  "messages": {
   "type": "array",
   "description": "OpenAI chat messages: [{role, content}] - text and image_url content blocks supported"
  },
  "reasoning": {
   "type": "object",
   "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."
  },
  "max_tokens": {
   "type": "number",
   "description": "Output token cap (clamped to the tier maximum)"
  },
  "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": {
   "type": "integer",
   "description": "Optional - alias of max_tokens (newer OpenAI SDKs send this)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "id": "gen-…",
  "model": "openai/gpt-4o-mini",
  "usage": {
   "total_tokens": 13,
   "prompt_tokens": 12,
   "completion_tokens": 1
  },
  "object": "chat.completion",
  "choices": [
   {
    "index": 0,
    "message": {
     "role": "assistant",
     "content": "OK"
    },
    "finish_reason": "stop"
   }
  ],
  "created": 1750000000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-chat-completions-x402-pay-per-call-a2a50c28/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
