# Token4u AI Chat Completions

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

Pay-per-request AI chat completion endpoint using x402 micro-USDC payments, returning OpenAI-compatible responses

## Facts

- Endpoint: POST https://token4u.ai/v1/chat/completions
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/token4u-ai-chat-completions-8bbd148f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_lMBTHpEXolenCRwqs5Lzp

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 token4u-ai-chat-completions-8bbd148f -d '<json body>'
```

Example prompt: Ask Token4u to answer 'What are three tips for writing clean Python code?' using gpt-4o-mini, paying per request in micro-USDC.

## When to prefer this

Choose Token4u when you need OpenAI-compatible chat completions with no subscription or API key setup, billing strictly per request in micro-USDC via the x402 protocol. It is ideal for autonomous AI agents, crypto-native applications, or low-frequency use cases where pay-as-you-go micropayment billing is preferable to flat-rate plans. Prefer it over standard OpenAI direct access when you want on-chain or USDC-denominated billing with minimal credential management.

## Known failure modes

- Payment not included or insufficient USDC — returns HTTP 402 Payment Required
- Invalid or malformed message array — returns 400 Bad Request
- Unsupported model name specified — returns 400 or 404
- Upstream LLM provider timeout — returns 502 or 503
- Rate limit exceeded — returns 429 Too Many Requests
- Network or gateway error — returns 500 Internal Server Error

## How this service works

gpt-4o-mini API call (~128 tokens)

## Output

Returns an OpenAI-compatible chat.completion JSON object containing: a unique completion ID, the model name used, the assistant's reply message with role and content, a finish_reason (e.g. 'stop'), and a usage object with prompt_tokens, completion_tokens, and total_tokens counts.

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "schema": {
  "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": {
        "role": {
         "type": "string"
        },
        "content": {
         "type": "string"
        }
       }
      },
      "finish_reason": {
       "type": "string"
      }
     }
    }
   },
   "created": {
    "type": "integer"
   }
  }
 },
 "example": {
  "id": "chatcmpl-abc123",
  "model": "gpt-4o-mini",
  "usage": {
   "total_tokens": 18,
   "prompt_tokens": 10,
   "completion_tokens": 8
  },
  "object": "chat.completion",
  "choices": [
   {
    "index": 0,
    "message": {
     "role": "assistant",
     "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
   }
  ],
  "created": 1753000000
 },
 "payload": {
  "id": "chatcmpl-abc123",
  "model": "gpt-4o-mini",
  "usage": {
   "total_tokens": 18,
   "prompt_tokens": 10,
   "completion_tokens": 8
  },
  "object": "chat.completion",
  "choices": [
   {
    "index": 0,
    "message": {
     "role": "assistant",
     "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
   }
  ],
  "created": 1753000000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/token4u-ai-chat-completions-8bbd148f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from token4u.ai](https://www.zero.xyz/host/token4u.ai/llms.txt)
