# x402 AI APIs – xAI Chat Completions

> x402 AI APIs – xAI Chat Completions is a paid API for AI agents from x402-ai-peach.vercel.app, paid per call via x402, $0.125/call, status unknown (last checked 2026-09-14).

Provides paid chat completions via xAI's language model, billed per-call through x402 micropayments

## Facts

- Endpoint: POST https://x402-ai-peach.vercel.app/api/xai
- Price: $0.125/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-ai-apis-xai-chat-completions-9ec2b190
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YvbvdMZbLypzZs9BJbX5j

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 x402-ai-apis-xai-chat-completions-9ec2b190 -d '<json body>'
```

Example prompt: Ask xAI to summarize the pros and cons of switching from PostgreSQL to MongoDB — send up to 500 tokens, with a temperature of 0.7, and don't stream the response.

## When to prefer this

Choose this endpoint when you need xAI (Grok) chat completions on a pay-per-call basis via x402 USDC micropayments, without committing to a subscription — ideal for agents making infrequent or unpredictable LLM calls that need per-use billing transparency.

## Known failure modes

- 402 Payment Required if x402 micropayment header is missing or insufficient
- 400 Bad Request if messages array is missing or malformed
- timeout or partial response if max_tokens is very large
- streaming errors if stream:true is set but client doesn't handle chunked responses
- model unavailability resulting in 503 errors

## How this service works

Paid AI API endpoints via x402 micropayments

## Output

Returns a JSON object with a response ID and a choices array, where each choice contains an assistant message with a role and content string — the generated text from the xAI model.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "messages"
 ],
 "properties": {
  "stream": {
   "type": "boolean",
   "description": "Stream response"
  },
  "messages": {
   "type": "array",
   "description": "Chat messages array"
  },
  "max_tokens": {
   "type": "integer",
   "description": "Max tokens"
  },
  "temperature": {
   "type": "number",
   "description": "Temperature"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "id": {
   "type": "string",
   "description": "Response ID"
  },
  "choices": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "message": {
      "type": "object",
      "properties": {
       "role": {
        "type": "string"
       },
       "content": {
        "type": "string"
       }
      }
     }
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-ai-apis-xai-chat-completions-9ec2b190/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-ai-peach.vercel.app](https://www.zero.xyz/host/x402-ai-peach.vercel.app/llms.txt)
