# Chat Completion Billed Per Token (Metered 402)

> Chat Completion Billed Per Token (Metered 402) is a paid API for AI agents from llmrt-companion.manhliemcn4euwlu.workers.dev, paid per call via x402, $0.000142/call, status unknown (last checked 2026-11-15).

OpenAI-compatible chat completion endpoint that uses x402 pay-per-token billing, charging only for actual tokens consumed based on a pre-quoted cost.

## Facts

- Endpoint: GET https://llmrt-companion.manhliemcn4euwlu.workers.dev/chat-metered-402?utm_source=zero.xyz
- Price: $0.000142/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chat-completion-billed-per-token-metered-402-6eec3bb6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_IuupBVL4KTBOPxLzEF-G0

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 chat-completion-billed-per-token-metered-402-6eec3bb6
```

Example prompt: Complete this prompt using the metered chat endpoint — 'Explain the difference between supervised and unsupervised learning in plain English' — with a max_tokens budget of 300 and bill me only for what's actually used.

## When to prefer this

Choose this endpoint when you want LLM chat completions with true pay-per-token economics via x402 micropayments — ideal for agents that need cost-predictable inference without pre-purchasing credits or holding an API key. Prefer over flat-rate endpoints when prompt length varies widely and you want to avoid overpaying for short completions. Best suited for automated pipelines that can handle x402 payment handshake flows.

## Known failure modes

- Payment not completed or x402 order_id missing — returns 402 with a token-count quote before payment
- max_tokens not declared — may result in unbounded billing or rejection
- Prompt too long for model context window — returns error with token limit details
- Workers AI upstream timeout — returns 5xx with no completion
- Invalid or expired order_id — payment rejected and completion not returned

## How this service works

Chat completion billed per token: the 402 quotes your input tokens plus your declared max_tokens, and you pay for what the call actually uses. OpenAI-compatible, no signup, no API key.

## Output

Returns an OpenAI-compatible chat completion response including the generated text, model name used, and token usage breakdown (prompt tokens, completion tokens, total), with the charge reflecting only the tokens actually consumed rather than the quoted maximum.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "order_id"
     ],
     "properties": {
      "prompt": {
       "type": "string"
      },
      "system": {
       "type": "string"
      },
      "order_id": {
       "type": "string"
      },
      "max_tokens": {
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chat-completion-billed-per-token-metered-402-6eec3bb6/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from llmrt-companion.manhliemcn4euwlu.workers.dev](https://www.zero.xyz/host/llmrt-companion.manhliemcn4euwlu.workers.dev/llms.txt)
