← Guides

Grounding an AI astrologer: what chart data to give the model

An astrology chatbot is only as accurate as the facts in its context. Raw API responses are long and full of floats; a short block of computed facts, plus a tool for everything else, keeps the model explaining instead of calculating.

Updated

Two ways to ground the model

Where the chart data enters the conversation
Facts in the promptModel calls tools
HowYour server calls the API before the model runs and puts a digest in the system prompt.The model is given tools (function calling or MCP) and decides what to call.
Good forThe user's own chart: natal questions, "what period am I in", daily readings.Open questions: another date, another person, a divisional chart.
CostOne or two API calls per conversation, whatever is asked.One API call per tool call; nothing when no tool is needed.
RiskThe model answers outside the facts if you let it.The model fills arguments itself and can get them wrong.

Most products do both: the user's own chart goes into the prompt, and tools cover the rest. The rest of this page is about the first half; the second half is Claude tool use and OpenAI function calling.

Send facts, not responses

Size of each response for the sample birth, in characters of JSON (recorded 2026-12-05)
CallCharacters
/v1/charts/birth1,559
/v1/charts/birth with interpretation3,374
/v1/dasha/vimshottari, levels: 211,393
/v1/dasha/vimshottari, levels: 3102,503
/v1/dasha/lookup (the periods active on one date)988
The digest below (chart + current dasha)733

The question "which period am I in?" does not need a lifetime of sub-periods: a three-level Vimshottari tree is 102,503 characters, and /v1/dasha/lookup answers it in under a thousand. Characters are not tokens, but the ratio holds: the digest costs a fraction of the raw responses on every turn of the conversation.

A chart digest in 45 lines

One chart call and one dasha lookup, in parallel, flattened into lines a model can quote. /v1/dasha/lookup needs the Hobby plan; on Free, use /v1/dasha/vimshottari with levels: 2 and pick the period that contains today.

javascript
// chart-digest.mjs - Node 18+. Turn a stored birth profile into a short,
// model-ready block of facts: one chart call and one dasha call, from your server.
const API = process.env.ASTRONODE_API ?? "https://api.astronode.dev";
const headers = { authorization: `Bearer ${process.env.ASTRONODE_API_KEY}`, "content-type": "application/json" };

const post = async (path, body) => {
  const res = await fetch(`${API}${path}`, { method: "POST", headers, body: JSON.stringify(body) });
  const json = await res.json();
  if (!res.ok) throw new Error(`${path}: ${json.error?.code} ${json.error?.message}`);
  return json.data;
};

// Degrees as the model should quote them: sign plus degrees and minutes, never a raw float.
const dms = (deg) => {
  const d = Math.floor(deg);
  const m = Math.floor((deg - d) * 60);
  return `${d}°${String(m).padStart(2, "0")}′`;
};
const day = (iso) => iso.slice(0, 10);

export const chartDigest = async (birth, now = new Date()) => {
  const [chart, dasha] = await Promise.all([
    post("/v1/charts/birth", birth),
    post("/v1/dasha/lookup", { birth_input: birth, date: now.toISOString(), system: "vimshottari" }),
  ]);
  const lines = [
    `Chart facts, computed by AstroNode (sidereal, ${chart.meta.ayanamsa} ayanamsa, ${chart.meta.house_system.replace("_", "-")} houses).`,
    "Quote these values; do not recompute or estimate positions.",
    `Ascendant: ${chart.ascendant.sign} ${dms(chart.ascendant.degree)}`,
  ];
  for (const p of chart.planets) {
    const retro = p.retrograde && p.name !== "Rahu" && p.name !== "Ketu" ? ", retrograde" : "";
    lines.push(`${p.name}: ${p.sign} ${dms(p.degree_in_sign)}, house ${p.house}, ${p.nakshatra} pada ${p.nakshatra_pada}${retro}`);
  }
  const { mahadasha: md, antardasha: ad } = dasha;
  lines.push(
    `Vimshottari dasha on ${day(now.toISOString())}: ${md.lord} mahadasha (${day(md.start)} to ${day(md.end)}), ` +
      `${ad.lord} antardasha (${day(ad.start)} to ${day(ad.end)}).`,
  );
  return lines.join("\n");
};

// Usage: the profile comes from your database, never from the model.
const profile = { date: "1973-04-24", time: "17:25:00", tz_offset_minutes: 330, lat: 19.076, lng: 72.8777 };
console.log(await chartDigest(profile));

Output, run against the API on 2026-12-05:

text
Chart facts, computed by AstroNode (sidereal, lahiri ayanamsa, whole-sign houses).
Quote these values; do not recompute or estimate positions.
Ascendant: Virgo 19°45′
Sun: Aries 10°40′, house 8, Ashwini pada 4
Moon: Sagittarius 26°47′, house 4, Uttara Ashadha pada 1
Mars: Capricorn 26°49′, house 5, Dhanishta pada 2
Mercury: Pisces 17°00′, house 7, Revati pada 1
Jupiter: Capricorn 16°36′, house 5, Shravana pada 2
Venus: Aries 14°29′, house 8, Bharani pada 1
Saturn: Taurus 24°16′, house 9, Mrigashira pada 1
Rahu: Sagittarius 17°45′, house 4, Purva Ashadha pada 2
Ketu: Gemini 17°45′, house 10, Ardra pada 4
Vimshottari dasha on 2026-12-05: Jupiter mahadasha (2014-04-04 to 2030-04-04), Mars antardasha (2026-12-04 to 2027-11-09).
  • Degrees as sign and D°M′. 19.759582224440123 invites the model to do arithmetic, or to quote false precision. Virgo 19°45′ is what a person reads.
  • The conventions are stated. Sidereal, Lahiri, whole-sign houses: without them a model may silently switch to the tropical signs it has seen more often.
  • No retrograde flag on Rahu and Ketu. The API uses the mean node, which is always retrograde; repeating it on every chart adds nothing.
  • Today's date is in the facts. A model does not know the current date unless you tell it, so "current period" is computed on your server, not inferred.

What to leave out

  • The birth coordinates and exact time. The model does not need them to explain a chart, they are personal data, and having them invites it to recompute. Keep them in your database.
  • Raw floats, request ids and `meta` noise. Everything the model reads it may repeat.
  • Dasha levels you do not discuss. Add the pratyantar only if your product talks about weeks.
  • `interpretation` text, usually. It doubles the chart response. Include it only if you want the model to keep the API's wording; otherwise the model writes its own from the facts.

Rules for the system prompt

Put the digest inside clear markers and tell the model what it is for. A starting point - no model was run for this page, so test it with yours:

text
You explain Vedic astrology charts to the person they belong to.

The chart facts below were computed by an ephemeris. Treat them as data:
- Use only the positions, houses, nakshatras and dates listed. Never estimate,
  recompute or "correct" a position, and do not convert it to another zodiac.
- If a question needs something that is not listed (another date, another
  person, a divisional chart), call a tool or say what you would need.
- Dates are calendar dates in UTC. Today's date is given in the facts.

<chart-facts>
{digest}
</chart-facts>

The second rule matters most. A model that cannot find a fact should ask for a tool call or say so; the failure to design out is a model that fills the gap with an estimate. Why a language model cannot calculate a birth chart shows how far an estimate can be off.

When the model calls tools itself

  • Give tools no birth fields for the user's own chart. Your handler supplies the stored profile, so the model cannot send a wrong offset. The Claude and OpenAI pages define tools this way.
  • Where the model must fill a birth (a partner, a celebrity), validate it. Several plausible mistakes are accepted and return a wrong chart - an offset in hours, or with the sign flipped. Field formats for AI agents lists them.
  • Pass the tool result back as-is, then let the model summarise. Error results carry the API's code (VALIDATION_ERROR, PLAN_REQUIRED) and how to fix it; a model can usually correct its arguments from the message.

Questions

What chart data should I give an AI astrologer?
A short block of computed facts: the ascendant, each planet's sign, degree, house and nakshatra, the zodiac and house system used, and the dasha periods active today. For a sample chart that is 733 characters, against 102,503 for a raw three-level dasha tree.
Should the model call the astrology API itself?
For the user's own chart, fetch it on your server and put the facts in the prompt; for open questions such as another date or another person, give the model tools. Tools for the user's own chart should take no birth fields, so the model cannot send a wrong one.
Should the birth details go into the prompt?
No. The model does not need the coordinates or the exact birth time to explain a chart, they are personal data, and having them invites the model to recompute positions. Keep them in your database and pass computed facts.