中国玄学数据 · 直供 AI 代理

cn402

Chinese metaphysics, calendar and divination data — BaZi, I Ching, Feng Shui, TCM, almanac, and more — priced and structured for autonomous agents, settled trustlessly over x402.

75 endpoints · 11 categories · USDC on Base · no accounts, no API keys, no subscriptions

01 Quick start

Install (JS / TypeScript)

npm i x402-fetch viem
import { wrapFetchWithPayment } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount("0xYOUR_KEY");
const wallet  = createWalletClient({ account, chain: base, transport: http() });
const pay     = wrapFetchWithPayment(fetch, wallet);

const r = await pay("https://api.cn402.com/bazi/sizhu?date=1990-06-15T08:30");
console.log(await r.json());   // 402 -> auto-sign EIP-3009 -> 200 + data

Inspect from the command line

curl -i https://api.cn402.com/iching/divine
# HTTP/1.1 402 Payment Required
# the body carries the x402 payment terms (network, amount, asset)
# a paying client signs EIP-3009 and retries with the X-PAYMENT header

Any x402-capable client or agent works — the protocol is plain HTTP. Python client and MCP server are on the way.

02 How it works

x402 is HTTP's native payment standard. The server returns 402 Payment Required with payment terms; the client signs an EIP-3009 authorization; the Coinbase CDP facilitator settles on Base; the request is fulfilled. End-to-end in roughly one second. No account, no key, no subscription — the agent simply pays per call.

03 Links

04 Get your API on x402

402 上线服务 · API onboarding

Have an API or data feed you want agents to pay for? We handle the full x402 integration — payment gating, pricing, on-chain settlement, manifest and directory listing — and get you live and discoverable.

把你的 API 接入 x402:我们负责支付网关、定价、链上结算、manifest 与目录收录,一条龙上线并让 agent 可发现。

business@cn402.com →

05 Endpoints (75)

⚠ These endpoints are paid programmatically by AI agents and x402 clients. Clicking a link opens the raw API and returns HTTP 402 — do not try to pay manually with a browser wallet; it will not complete. Integrate with an x402 client (x402-fetch) or an x402-capable agent.

fortune · 15

/age/calc $0.008 Compute Chinese nominal age (xu sui), Western actual age, days lived, and lunar birthday from any birth date. /almanac $0.08 Returns lunar date, ganzhi heavenly stems and earthly branches (天干地支), na yin (纳音), yi ji auspicious activities (宜忌), zodiac day clash, 28 lunar mansions (二十八宿), 12 day officers (建除十二神), pengzu taboos (彭祖百忌). /almanac/hours $0.08 Returns all 12 shichen (two-hour periods) of a date, each with its 宜 (favorable), 忌 (taboo) activities and 黄道/黑道 quality. /almanac/month $0.16 Returns every day of a given month with its 宜 (favorable) and 忌 (taboo) activities, 黄道/黑道 day quality, day clash, solar terms (jieqi) and festivals. /almanac/select $0.16 Given an activity (嫁娶/开市/出行/动土/入宅/安床/祭祀/纳财...) and a date range, returns the auspicious days where that activity appears in 宜 (favorable) and not in 忌 (taboo), with day clash and lunar date. /festival/cn $0.016 All traditional Chinese festivals for a given year with their Gregorian dates. /festival/today $0.008 Today Chinese festival lookup (今日节日). /jieqi $0.016 All 24 solar terms for a given year with exact UTC timestamps. /lunar $0.016 Convert any Gregorian date to Chinese lunar date with full traditional context: lunar year-month-day, year/month/day gan-zhi pillars, zodiac animal year, leap month flag. /sanfu/sanjiu $0.016 Exact dates for the three sanfu (dog day) periods and three sanjiu (coldest) periods of a given year. /solar $0.016 Chinese lunar to solar conversion, lunar to Gregorian, 农历转公历, Chinese lunar date to Western calendar, reverse lunar calendar lookup. /timepoint $0.016 Convert any time of day to the corresponding Chinese shichen (one of 12 two-hour periods), including its name, zodiac animal, and elemental association. /today $0.08 Comprehensive today summary: lunar date, gan-zhi pillars, zodiac, yi/ji activities, current festival if any, current solar term, dog days/coldest period flag. /today/full $0.08 Bundles lunar date + gan-zhi + zodiac + yi/ji auspicious activities + day clash + lucky directions + 28 mansions + day officer + solar terms (jieqi) + today's festivals. /zodiac $0.016 Get the Chinese zodiac animal for any year, including element (gold/wood/water/fire/earth) and 60-year sexagenary name.

bazi · 10

iching · 10

/iching/bagua $0.016 Get all 8 trigrams (Ba Gua) with element, direction, family role, body part, and natural symbol mappings. /iching/coin $0.08 I Ching three-coin method, 摇卦, coin oracle, Three Coin Yi Jing, 铜钱占卜, traditional I Ching divination, changing lines coin toss, 本卦变卦 original transformed hexagram. /iching/divine $0.16 I Ching divination by question, 易经占卜问事, Yi Jing reading for specific question, contextual hexagram interpretation, structured oracle reading with judgment image lines. /iching/full $0.32 Complete I Ching analysis, full hexagram reading, 易经全卦分析, hexagram with all relations changing lines yao text bagua trigrams complete in one call, Yi Jing deep reading. /iching/hexagram $0.016 Look up a specific I Ching hexagram by number (1-64) and get its full traditional interpretation. /iching/list $0.016 Return all 64 I Ching hexagrams with name, number, and traditional sequence. /iching/meihua $0.08 Cast a hexagram using the Plum Blossom Numerology method from given numbers (time, date, or arbitrary). /iching/random $0.08 I Ching random hexagram, Book of Changes random draw, random divination cast, 周易, 易经, 卦象随机, Yijing oracle, random 64 hexagrams, Chinese divination quick draw, casual Yi Jing reading. /iching/relations $0.08 For a given hexagram return its nuclear (互卦), inverse (综卦), and opposite (错卦) related hexagrams. /iching/yao $0.016 I Ching line meaning, 爻辞, individual line text, yao ci, hexagram line by line, 初九 九二 九三, I Ching line interpretation.

fengshui · 8

/fengshui/24shan $0.08 The 24-Mountain compass (each spans 15°) used in classical Chinese Feng Shui, each with its trigram parent, element, and yin/yang. /fengshui/bagua-direction $0.016 Bagua direction mapping, 八卦方位, Eight Trigrams compass, Pre-Heaven Post-Heaven Bagua direction, 先天后天八卦方位, Qian Kun Zhen Xun Kan Li Gen Dui, Heaven Earth Thunder Wind Water Fire Mountain Lake direction. /fengshui/bed-direction $0.08 Calculate the optimal direction to place a bed (head direction) for a person, based on their kua number using Ba Zhai (Eight Mansions) method. /fengshui/biorhythm $0.016 Compute personal biorhythm (physical 23-day, emotional 28-day, intellectual 33-day) from birth date for a target date. /fengshui/business-direction $0.08 Recommend the most auspicious door-facing direction and wealth corner for a business based on owner's kua and business type. /fengshui/direction $0.016 Feng Shui direction analysis, 风水方位, 8 cardinal directions, Chinese compass, luopan, 罗盘, lucky direction by birth, personal kua number direction, 命卦方位, north south east west northeast southeast southwest northwest auspicious direction. /fengshui/feixing $0.08 Flying Stars, 玄空飞星, Xuan Kong Fei Xing, period 9 flying stars, 三元九运, Feng Shui period 1-9, 9-grid star chart, annual monthly flying stars, Chinese space-time Feng Shui. /fengshui/move-day $0.16 Find auspicious days for moving house within a date range, considering the resident's birth year (zodiac clash) and traditional moving rules.

zhanbu · 8

hanzi · 6

folk · 5

tcm · 5

geo · 4

weather · 2

x402 · 2