Astrology API for AI agents and chatbots
Give Claude, Cursor or your own LLM app accurate panchang, kundli and festival answers, via MCP or tool calling.
Language models are good at explaining astrology and bad at computing it: they guess tithis, mix up festival dates and cannot place planets. The fix is to let the model call an API for the facts and do the explaining itself. There are two ways to do that with LifeAstroAPI.
Option A: the MCP server (no code)
The open-source LifeAstro MCP server exposes 310 tools covering the whole API, for Claude Desktop, Cursor, Codex and other clients that run local MCP servers. Install it with Homebrew or go install, then add it to your client:
{
"mcpServers": {
"lifeastro": {
"command": "lifeastro-mcp",
"env": { "LIFEASTRO_API_KEY": "dv_live_..." }
}
}
}Then just ask. For example:
- “When is Ekadashi in Toronto next month, and what is the parana window?”
- “Give me the full Hindu calendar sheet for October 2027 in Chennai.”
- “Birth chart for 15 Jan 1990, 10:30, Mumbai, and the current dasha.”
Tool calls use your normal API key and credits. See the MCP page for the full tool list.
Option B: tool calling in your own app
If you are building your own chatbot on any LLM that supports tool (function) calling, define a small tool, and run the matching API call when the model asks for it. A tool definition:
{
"name": "get_daily_panchang",
"description": "Hindu panchang for a date and place: tithi, nakshatra, yoga, karana with end times, sunrise, Rahu Kaal and other muhurta windows.",
"input_schema": {
"type": "object",
"properties": {
"date": { "type": "string", "description": "YYYY-MM-DD" },
"tz": { "type": "string", "description": "IANA timezone, e.g. Asia/Kolkata" },
"lat": { "type": "number" },
"lon": { "type": "number" }
},
"required": ["date", "tz", "lat", "lon"]
}
}And its implementation:
// When the model calls get_daily_panchang, run this and return the JSON.
async function getDailyPanchang({ date, tz, lat, lon }) {
const q = new URLSearchParams({ date, time: '06:00', tz, lat: String(lat), lon: String(lon) });
const r = await fetch('https://api.lifeastroapi.com/v1/panchang/advanced?' + q, {
headers: { Authorization: 'Bearer ' + process.env.LIFEASTRO_API_KEY },
});
const p = await r.json();
// Hand the model a compact answer, not the whole payload.
return {
tithi: p.tithi.paksha + ' ' + p.tithi.name + ' until ' + p.tithi.end_local,
nakshatra: p.nakshatra.name + ' until ' + p.nakshatra.end_local,
sunrise: p.sunrise_local,
rahu_kaal: p.muhurta.rahu_kaal.start_local + ' – ' + p.muhurta.rahu_kaal.end_local,
};
}Design tips
- Few, broad tools beat many narrow ones. One “daily panchang” tool backed by
/v1/panchang/advancedanswers most timing questions. - Return compact results. Pick the fields the model needs, as above; smaller tool results mean faster, cheaper and more accurate answers.
- Always pass location and timezone. Tithi and festival dates change with place. Ask the user for their city once and keep it in the conversation.
- Let the model narrate. The API gives exact data; for ready-written text in Hindi and other languages, the narrative endpoints return authored predictions.
Related
- Recipe: AI astrology chatbot
- llms-full.txt: the whole endpoint catalog in one plain-text file, handy as model context
- How to build a Vedic astrology app