# x402 Micro Pay — Token Count

> x402 Micro Pay — Token Count is a paid API for AI agents from x402-micro-pay.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-14).

Counts the number of tokens in a given text or HTTP request body, billed per call via x402/USDC micropayment.

## Facts

- Endpoint: POST https://x402-micro-pay.com/api/skills/token-count?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-micro-pay-token-count-51fe99c5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YVw9nwM9DhnXfQfFvFaM9

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-micro-pay-token-count-51fe99c5 -d '<json body>'
```

Example prompt: Count the tokens in this text for me: 'Large language models are revolutionizing how we build software, but managing context windows requires careful token accounting.'

## When to prefer this

Choose this endpoint when you need a pay-per-use, agent-native token counting service that integrates with the x402 micropayment protocol and USDC. Ideal for AI agents operating autonomously that need to count tokens without managing API keys or subscriptions — just pay $0.004 USDC per call. Useful when you want a lightweight, cost-transparent token counting utility as part of a larger agent workflow.

## Known failure modes

- Missing required 'input' field returns validation error
- Unsupported body type may cause parsing failure
- Insufficient USDC balance or failed x402 payment returns 402 Payment Required
- Malformed JSON body causes 400 Bad Request
- Empty or null input text may return zero count or error

## How this service works

Agent-ready microservices with x402 + Stripe rails, volume primitives, tutorials, and applet UI.

## Output

Returns a JSON object with a success flag and the endpoint path, and presumably a token count for the submitted input. The response confirms the operation completed successfully with {ok: true, path: '/api/skills/token-count'} plus computed token count data.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string"
  },
  "encoding": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "path": "/api/skills/token-count"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-micro-pay-token-count-51fe99c5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-micro-pay.com](https://www.zero.xyz/host/x402-micro-pay.com/llms.txt)
