# fastapi.online Chat Completion

> fastapi.online Chat Completion is a paid API for AI agents from api.fastapi.online, paid per call via x402, $0.0015/call, status down (last checked 2026-09-15).

Send a list of messages to a self-hosted LLM and receive a chat completion response, billed per call via crypto with no signup required.

## Facts

- Endpoint: POST https://api.fastapi.online/chat
- Price: $0.0015/call
- Payment: x402
- Status: down
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fastapi-online-chat-completion-4eac4a6e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_WVhBf5hmefClTRpHiNvdq

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 fastapi-online-chat-completion-4eac4a6e -d '<json body>'
```

Example prompt: Send this message thread to the AI and get a response: system says 'You are a helpful assistant', user says 'Explain quantum entanglement in two sentences' — use temperature 0.7 and pay per call with USDC, no account needed.

## When to prefer this

Choose this endpoint when you need pay-per-call LLM chat completions with no account or subscription required, accepting crypto (USDC) micro-payments. Ideal for agents that need anonymous or frictionless AI inference, or when you want to avoid monthly API key commitments. Less suitable if you need guaranteed uptime SLAs, specific well-known hosted model names (GPT-4, Claude), or extensive usage dashboards.

## Known failure modes

- Payment not provided or insufficient USDC — HTTP 402 returned requiring payment
- Missing required 'messages' field — validation error returned
- Invalid model name — may return error or fall back to default model
- Temperature out of expected range — may cause unexpected behavior
- Network timeout if inference takes too long for large prompts
- Malformed messages array — schema validation error

## How this service works

Self-hosted AI API gateway. Expensive endpoints require an x402 micropayment (USDC on Base) before executing.

## Output

Returns a JSON object containing the assistant's reply message (with role and content fields), the model name used, and usage statistics including prompt token count and completion token count.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "messages"
     ],
     "properties": {
      "model": {
       "type": "string"
      },
      "messages": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "role",
         "content"
        ],
        "properties": {
         "role": {
          "enum": [
           "system",
           "user",
           "assistant"
          ],
          "type": "string"
         },
         "content": {
          "type": "string"
         }
        }
       }
      },
      "temperature": {
       "type": "number"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "model": "llama3.1:8b",
  "usage": {
   "prompt_tokens": 9,
   "completion_tokens": 8
  },
  "message": {
   "role": "assistant",
   "content": "Hi! How can I help?"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fastapi-online-chat-completion-4eac4a6e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fastapi.online](https://www.zero.xyz/host/api.fastapi.online/llms.txt)
