# TextKit Shannon Entropy

> TextKit Shannon Entropy is a paid API for AI agents from textkit.johnaio281.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-22).

Computes Shannon entropy of a text string, returning total entropy in bits, bits-per-character, length, and distinct character count

## Facts

- Endpoint: GET https://textkit.johnaio281.workers.dev/api/tk/entropy?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/textkit-shannon-entropy-b047a18e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_AbGERU3bHytROVCFEyLRa

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 textkit-shannon-entropy-b047a18e
```

Example prompt: What's the Shannon entropy of the string 'P@ssw0rd123!'? I want to know total bits, bits per character, and how many distinct characters it has.

## When to prefer this

Use this endpoint when you need a quick, pay-per-use Shannon entropy calculation for a single text string without setting up any infrastructure or API keys. Ideal for security audits, password quality checks, anomaly detection pipelines, or any agent workflow that needs to quantify information randomness on the fly. Prefer this over building your own entropy function when operating in a serverless or agent-orchestration context that already uses x402/USDC micropayments.

## Known failure modes

- Missing required `text` query parameter returns an error
- Empty string may return zero entropy or an error
- Very long strings may hit request size limits
- Network or worker timeout on extremely large inputs

## How this service works

General-purpose text, Unicode and date utilities for AI agents: homoglyph folding and spoofed-domain detection, Unicode script detection, NFC/NFD normalization, grapheme counting, date description (weekday, ISO week, quarter, leap year), business-day counting, slugify, FNV-1a hashing, Shannon entropy, string format detection (uuid, email, url, ipv4, jwt, iban), byte-encoding detection and human-readable byte sizes. Pay per request in USDC on Base via x402 - no signup, no API key, no KYC.

## Output

A JSON object with four fields: `length` (number of characters in the input), `entropy` (total Shannon entropy in bits), `bitsPerChar` (entropy divided by length), and `distinctChars` (number of unique characters). Example: {"length":8,"entropy":3,"bitsPerChar":3,"distinctChars":8}.

## 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"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "text"
     ],
     "properties": {
      "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": {
  "length": 8,
  "entropy": 3,
  "bitsPerChar": 3,
  "distinctChars": 8
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/textkit-shannon-entropy-b047a18e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from textkit.johnaio281.workers.dev](https://www.zero.xyz/host/textkit.johnaio281.workers.dev/llms.txt)
