x402 Utils
Exact utilities for agents, paid per call in USDC on Base: time zones and DST, date arithmetic and business days, holidays, cron schedules, unit conversion, exact math, phone number validation, IDs, hashes, encodings, JWT decoding, JSON Schema validation, regular expressions, LLM token counts and text diffs. Invalid input is not charged.
Paid per call over x402 in USDC on Base. No account or API key: an unpaid request answers 402 with the payment options, and any x402 client pays and retries. GET endpoints take query parameters; POST endpoints (hash, encode, jwt, json-schema, regex, tokens, diff) take a JSON body. A 400 answer means the input was invalid; no payment is settled for it.
GET /v1/time $0.001
The current time, or a given time, in one or more IANA time zones, with UTC offset, abbreviation, whether daylight saving time is in effect, and the weekday. Give a local time with from_tz to convert it, handling DST correctly.
curl -i "https://utils.kagurazaka.dev/v1/time?tz=America%2FNew_York%2CEurope%2FLondon&at=2026-10-25+09%3A00&from_tz=Asia%2FTokyo"
GET /v1/date $0.001
Add or subtract an ISO 8601 duration (P1M, P2W, PT36H) to a date, months clamped to the month's end; or count the days, weeks, calendar months, years, seconds and business days (Monday to Friday, less a country's public holidays) between two dates. Also the weekday, ISO week and day of year.
curl -i "https://utils.kagurazaka.dev/v1/date?start=2026-10-25&end=2026-12-25&country=JP"
GET /v1/holidays $0.001
Holidays of a country (and optionally a state or region) in a year, with date, name and type (public, bank, school, optional, observance), from the date-holidays data for about 200 countries.
curl -i "https://utils.kagurazaka.dev/v1/holidays?country=JP&year=2026&lang=en"
GET /v1/cron $0.001
Explain a cron expression in plain English and list its next run times in a time zone (5 or 6 fields, with ranges, steps, L, W and #).
curl -i "https://utils.kagurazaka.dev/v1/cron?expr=0+9+*+*+1-5&tz=Asia%2FTokyo&count=3"
GET /v1/convert $0.001
Convert a value between units of length, mass, volume, temperature, speed, area, energy, power, pressure, data size, time and more (mathjs units), such as mi to km, degF to degC, GB to MiB, kWh to J.
curl -i "https://utils.kagurazaka.dev/v1/convert?value=26.2&from=mi&to=km"
GET /v1/math $0.001
Evaluate an arithmetic expression with 64 significant digits (no floating point surprises): operators, parentheses, powers, roots, logs, trigonometry, percentages, constants, units (5 inch to cm) and simple statistics.
curl -i "https://utils.kagurazaka.dev/v1/math?expr=0.1+%2B+0.2"
GET /v1/phone $0.001
Check whether a phone number is valid and possible, find its country and type (mobile, fixed line, toll free and others), and format it as E.164, international and national (libphonenumber metadata).
curl -i "https://utils.kagurazaka.dev/v1/phone?number=%2B1+650+253+0000"
GET /v1/id $0.001
Generate random IDs from a cryptographic source: UUID v4, UUID v7 (time ordered), ULID or nanoid, up to 100 at a time.
curl -i "https://utils.kagurazaka.dev/v1/id?type=uuid7&count=2"
POST /v1/hash $0.001
MD5, SHA-1, SHA-256, SHA-512, SHA3-256 and Keccak-256 (Ethereum) of a text, or of bytes given as hex or base64, as hex and base64.
curl -i -X POST https://utils.kagurazaka.dev/v1/hash -H 'content-type: application/json' -d '{"text":"hello","algorithms":["sha256","keccak256"]}'POST /v1/encode $0.001
Encode or decode text: base64, base64url, hex, URL (percent) encoding and HTML escaping.
curl -i -X POST https://utils.kagurazaka.dev/v1/encode -H 'content-type: application/json' -d '{"text":"hello world","op":"base64-encode"}'POST /v1/jwt $0.001
Decode a JSON Web Token's header and claims, and say when it was issued, when it expires, whether it has expired and in how many seconds it will. The signature is not verified.
curl -i -X POST https://utils.kagurazaka.dev/v1/jwt -H 'content-type: application/json' -d '{"token":"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjMiLCJleHAiOjE3OTI4ODY0MDB9.sig"}'POST /v1/json-schema $0.001
Validate a JSON value against a JSON Schema (draft-07 and 2019-09 keywords, formats such as email, uri, date-time) and list every error with its path. Patterns run on RE2, so a schema cannot stall the check.
curl -i -X POST https://utils.kagurazaka.dev/v1/json-schema -H 'content-type: application/json' -d '{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}},"data":{"email":"not-an-email"}}'POST /v1/regex $0.001
Run a regular expression on a text: every match with its position and capture groups (named too), and the text with a replacement applied. RE2 syntax, which runs in linear time (no lookaround or backreferences).
curl -i -X POST https://utils.kagurazaka.dev/v1/regex -H 'content-type: application/json' -d '{"pattern":"(?P<year>\\d{4})-(\\d{2})","text":"from 2026-10 to 2027-01","replacement":"$2/$1"}'POST /v1/tokens $0.001
Count the tokens of a text for OpenAI models (o200k_base for GPT-4o and later, cl100k_base for GPT-4), with characters, words and lines, to size prompts and estimate cost.
curl -i -X POST https://utils.kagurazaka.dev/v1/tokens -H 'content-type: application/json' -d '{"text":"Agents pay for APIs with x402."}'POST /v1/diff $0.001
Compare two texts by lines, words or characters: what was added and removed, and a unified diff for lines.
curl -i -X POST https://utils.kagurazaka.dev/v1/diff -H 'content-type: application/json' -d '{"a":"one\ntwo\nthree\n","b":"one\n2\nthree\nfour\n"}'