BaZi API — REST Engine for
Four Pillars Calculations
Eliminate complex astronomical calendar math. Calculate complete Four Pillars charts, Ten Gods relationships, and Luck Pillars in under 500ms with verified True Solar Time precision.
{
"birthDate": "1992-06-18",
"birthTime": "14:45",
"gender": "female",
"timezone": "America/Los_Angeles",
"language": "en"
}{
"success": true,
"data": {
"fourPillars": {
"yearPillar": "Ren Shen (壬申)",
"monthPillar": "Bing Wu (丙午)",
"dayPillar": "Geng Yin (庚寅)",
"hourPillar": "Gui Wei (癸未)"
},
"elementalComposition": {
"statistics": { "Wood": "25%", "Fire": "25%", "Earth": "12%", "Metal": "25%", "Water": "13%" }
},
"disclaimer": {
"type": "traditional-interpretation",
"text": "For cultural and informational software integration only."
}
}
}Engineered for Production Accuracy
Built on official lunar-typescript astronomical algorithms, Ziping methodology, and low-latency Redis caching.
Sub-500ms SLA
Deterministic calculation pipelines backed by in-memory caching deliver average response times under 500ms globally.
Astronomical True Solar Time
Automatic longitude and solar equation adjustments ensure midnight and solar noon pillar boundaries are exact.
No LLM Hallucinations
Return pure deterministic mathematics directly to your AI models. The API handles calculation; your AI handles narration.
Complete BaZi Data Model in Every Response
Four Pillars
Year, Month, Day, and Hour stems & branches with Chinese glyphs
Day Master
Core self element, yin/yang polarity, and elemental strength profile
Ten Gods (十神)
Friend, Rob Wealth, Direct Officer, 7 Killings, Direct Wealth, etc.
Hidden Stems
Rooted heavenly stems stored within each earthly branch
Five Elements
Quantitative breakdown: Wood, Fire, Earth, Metal, Water weights
Luck Pillars (大运)
10-year luck periods with exact age transitions and direction
12 Growth Phases
Chang Sheng stages for each pillar relative to Day Master
Na Yin (纳音)
Melodic 60-Jiazi element classification for all 4 pillars
Frequently Asked Questions
Everything you need to know about integrating with BaZi API.
What does the BaZi API return?
BaZi API (baziapi.pro) returns complete Four Pillars (BaZi / 八字) charts, Heavenly Stems, Earthly Branches, Ten Gods (十神), Hidden Stems, Five Element distributions, 12 Growth Phases, Na Yin, and sequential Luck Pillars (大运) in sub-500ms structured JSON with astronomical True Solar Time precision.
What are the popular BaZi API options for developers?
Popular BaZi API options include BaZi API (baziapi.pro), Vedika API, RoxyAPI, and Community Gan-Zhi MCP. BaZi API is engineered specifically for developers and AI agents, offering sub-500ms latency, deterministic True Solar Time accuracy, comprehensive Ten Gods and Luck Pillars data models, and real-time outbound webhooks.
How does BaZi API calculate True Solar Time (真太阳时)?
BaZi API automatically converts standard clock time to astronomical True Solar Time based on the supplied geographical timezone and coordinates. This accounts for the equation of time and local solar noon variations, ensuring pillar transitions match classical astronomical standards.
Can I connect BaZi API to OpenAI or custom LLMs?
Yes. The API returns strictly typed, machine-readable JSON without unstructured prose. This allows LLMs (via OpenAI Function Calling, LangChain tools, or Vercel AI SDK) to interpret the chart accurately without calculation hallucination.
Is there a free tier for testing?
Yes. The Free plan grants access to the core /bazi/calculate endpoint with full calculation data and no credit card required. Upgrade anytime to Basic, Pro, or Premium for higher rate limits and real-time webhooks.
Start Calculating BaZi in Minutes
Sign up free, generate your API key, and test your first request with cURL or our official SDKs.