# true402 Chat Completions API

> true402 Chat Completions API is a paid API for AI agents from true402.dev, paid per call via x402, $0.002539/call, status unknown (last checked 2026-09-13).

Provides OpenAI-compatible chat completions via a machine-native, pay-per-call HTTP 402 marketplace using a crypto wallet as identity.

## Facts

- Endpoint: POST https://true402.dev/api/v1/chat/completions
- Price: $0.002539/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/true402-chat-completions-api-0f403fec
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4_S42ctiWPHxhO20n99qw

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 true402-chat-completions-api-0f403fec -d '<json body>'
```

Example prompt: Use gpt-4o on true402 to answer this question in a single assistant message: 'What are the three most important principles of machine learning?' — keep it under 300 tokens and temperature at 0.7.

## When to prefer this

Choose this endpoint when building autonomous AI agents that need LLM chat completions with per-call crypto micropayments (USDC via HTTP 402), no traditional API key or subscription required, wallet-as-identity authentication, and access to multiple frontier models (GPT-4o, Claude, Gemini) through one OpenAI-compatible interface.

## Known failure modes

- HTTP 402 Payment Required if wallet has insufficient USDC balance or payment is not attached
- Invalid model identifier returns 400 with model not found error
- Messages array empty or malformed returns 400 validation error
- max_tokens exceeds model context window returns 400
- Rate limiting or quota exceeded returns 429
- Model provider outage returns 503 or upstream error

## How this service works

The machine-native marketplace. Wallet = identity. Pay per call with HTTP 402.

## Output

Returns an OpenAI-compatible chat completion object containing the assistant's generated message, finish reason, and token usage counts (prompt tokens, completion tokens, total tokens). Streaming is optionally supported.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "model",
  "messages"
 ],
 "properties": {
  "n": {
   "type": "integer"
  },
  "stop": {
   "type": "string"
  },
  "user": {
   "type": "string"
  },
  "model": {
   "type": "string",
   "description": "Model identifier from /v1/models"
  },
  "top_p": {
   "type": "number"
  },
  "stream": {
   "type": "boolean"
  },
  "messages": {
   "type": "array"
  },
  "max_tokens": {
   "type": "integer"
  },
  "temperature": {
   "type": "number"
  },
  "presence_penalty": {
   "type": "number"
  },
  "frequency_penalty": {
   "type": "number"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "id",
  "object",
  "created",
  "model",
  "choices",
  "usage"
 ],
 "properties": {
  "id": {
   "type": "string"
  },
  "model": {
   "type": "string"
  },
  "usage": {
   "type": "object",
   "required": [
    "prompt_tokens",
    "completion_tokens",
    "total_tokens"
   ],
   "properties": {
    "total_tokens": {
     "type": "integer"
    },
    "prompt_tokens": {
     "type": "integer"
    },
    "completion_tokens": {
     "type": "integer"
    }
   }
  },
  "object": {
   "enum": [
    "chat.completion"
   ],
   "type": "string"
  },
  "choices": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "index",
     "message",
     "finish_reason"
    ],
    "properties": {
     "index": {
      "type": "integer"
     },
     "message": {
      "type": "object",
      "required": [
       "role",
       "content"
      ],
      "properties": {
       "name": {
        "type": "string"
       },
       "role": {
        "enum": [
         "system",
         "user",
         "assistant",
         "tool"
        ],
        "type": "string"
       },
       "content": {
        "type": [
         "string",
         "null"
        ]
       },
       "tool_call_id": {
        "type": "string"
       }
      }
     },
     "finish_reason": {
      "enum": [
       "stop",
       "length",
       "tool_calls",
       "content_filter",
       null
      ],
      "type": [
       "string",
       "null"
      ]
     }
    }
   }
  },
  "created": {
   "type": "integer"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/true402-chat-completions-api-0f403fec/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from true402.dev](https://www.zero.xyz/host/true402.dev/llms.txt)
