What hi returns, endpoint by endpoint
| Endpoints | How to ask | Returned with `hi` |
|---|---|---|
/v1/western/reports/* (personality, romantic, friendship, karma-destiny, moon-phase) | body language: "hi" | Hindi: data.language: "hi", Hindi summary, headings and disclaimer; the computed lines ("Sun in Taurus 4.2°.") stay English |
/v1/western/sun-sign/:sign/daily (and weekly, monthly) | query ?language=hi | Hindi: data.language: "hi", fully Hindi text |
/v1/chat/respond and /stream | body language: "hi" | The model answers in Hindi |
/v1/charts/birth, /v1/dosha/mangal, /v1/compatibility, /v1/reports/compatibility | interpretation.language | English, labelled honestly: the interpretation block comes back with language: "en" (a report job completes normally) |
/v1/horoscope/daily/:sign, /v1/horoscope/nakshatra | language | English, data.language: "en" |
So the request is always safe: hi is accepted everywhere it is listed, and an endpoint without Hindi text answers 200 in English rather than erroring. Any other value - ta, hi-IN, HI - is a 400 VALIDATION_ERROR naming the two allowed values. The language is per request; there is no account-level setting.
Node: ask once, render what came back
// hindi-output.mjs - Node 18+, server-side. Every endpoint used here is on the Free plan.
const API = "https://api.astronode.dev";
const birth = { date: "1973-04-24", time: "17:25:00", tz_offset_minutes: 330, lat: 19.076, lng: 72.8777 };
const call = async (method, path, body) => {
const res = await fetch(API + path, {
method,
headers: { authorization: `Bearer ${process.env.ASTRONODE_API_KEY}`, "content-type": "application/json" },
...(body ? { body: JSON.stringify(body) } : {}),
});
return res.json();
};
// Ask for Hindi everywhere, then trust the `language` on the object you render.
const asked = [
["report", await call("POST", "/v1/western/reports/personality", { ...birth, language: "hi" }), (r) => r.data],
["sun-sign", await call("GET", "/v1/western/sun-sign/Leo/daily?language=hi&date=2026-12-01"), (r) => r.data],
["daily", await call("GET", "/v1/horoscope/daily/Leo?language=hi&date=2026-12-01"), (r) => r.data],
["chart", await call("POST", "/v1/charts/birth", { ...birth, interpretation: { language: "hi" } }), (r) => r.interpretation],
];
for (const [name, response, prose] of asked) {
const text = prose(response);
console.log(name.padEnd(10), "asked hi, got", text.language, "|", text.summary.slice(0, 48));
}
// Structured fields are English identifiers in every language. Localise them
// with your own table - which also covers the endpoints that answered "en".
const SIGN_HI = {
Aries: "मेष", Taurus: "वृषभ", Gemini: "मिथुन", Cancer: "कर्क", Leo: "सिंह", Virgo: "कन्या",
Libra: "तुला", Scorpio: "वृश्चिक", Sagittarius: "धनु", Capricorn: "मकर", Aquarius: "कुम्भ", Pisces: "मीन",
};
const chart = asked[3][1].data;
const moon = chart.planets.find((p) => p.name === "Moon");
console.log(`लग्न: ${SIGN_HI[chart.ascendant.sign]} | चंद्र: ${SIGN_HI[moon.sign]} (${moon.nakshatra})`);$ node hindi-output.mjs report asked hi, got hi | आपकी सायन जन्म कुंडली एक पहचानने योग्य व्यक्तित् sun-sign asked hi, got hi | गर्व ठीक है - दूसरों को कुचलने वाला गर्व नहीं। daily asked hi, got en | You're more visible today than usual. Use it for chart asked hi, got en | A Virgo rising sign (the Lagna) brings analysis, लग्न: कन्या | चंद्र: धनु (Uttara Ashadha)
- Read the `language` on the object you render. For the Western reports and forecasts that is
data.language; for Vedic interpretations it is theinterpretationblock's ownlanguage. Do not use the envelope's top-levelinterpretation.languageon the Western routes - it is a generic summary and says"en"even whendatais Hindi. - Decide the fallback in the UI, not in the request. When
hicomes back asen, show the English text with a small "available in English" note, or hide the prose and keep the structured data. Re-asking does not help; the answer is deterministic. - Identifiers never translate. Sign, planet and nakshatra names and every enum value are stable English keys in both languages, so code can switch on them. Render them through a label table, as
SIGN_HIdoes - that table also gives a Hindi screen something to show where the prose is English. - Computed lines inside Hindi reports stay English ("Sun in Taurus 4.2°." under a Hindi heading). If the mix does not suit your screen, build those lines yourself from structured endpoints and use the report for its summary.
Python: Hindi answers from the chat API
On the chat host language steers the model's reply. The user can write in either script; the field decides the answer's language.
# hindi_chat.py - Python 3.9+, standard library only.
import json, os, urllib.error, urllib.request
CHAT = "https://chatbot-api.astronode.dev"
KEY = os.environ["ASTRONODE_API_KEY"]
user = {"date": "1973-04-24", "time": "17:25:00", "tz_offset_minutes": 330, "lat": 19.076, "lng": 72.8777}
def ask(language, message):
body = {"conversation_id": "user-42-hi", "user": user, "message": message, "language": language}
req = urllib.request.Request(
CHAT + "/v1/chat/respond",
data=json.dumps(body).encode(),
headers={"Authorization": "Bearer " + KEY, "Content-Type": "application/json"},
)
try:
with urllib.request.urlopen(req) as res:
return res.status, json.load(res)
except urllib.error.HTTPError as e:
return e.code, json.load(e)
status, ok = ask("hi", "मेरी बृहस्पति की महादशा कब खत्म होगी?")
print(status, ok["conversation_id"], ok["meta"]["llm_provider"], len(ok["response"]["message"]), "chars")
status, bad = ask("ta", "x") # only "en" and "hi" are accepted
print(status, bad["error"]["code"], bad["error"]["details"][0]["message"])$ python3 hindi_chat.py 200 user-42-hi stub 67 chars 400 VALIDATION_ERROR Invalid option: expected one of "en"|"hi"
Recorded against the chat API in memory with a stub model (llm_provider: "stub"), which always answers in English placeholder text; the request, status codes and validation are the production ones. A live model writes the reply in Hindi.
Designing for two languages
- Store the user's language once and pass it on every request that has the field. Showing both languages means two requests, and both are billable.
- Cache by birth data and requested language, and store the returned language with the entry so the UI can label it.
- Keep the API's Hindi disclaimer when you show Hindi prose - it is translated alongside the report.
- Expect the "English, labelled en" rows to change as Hindi content ships. Code that reads the returned
languagepicks that up with no release.
Questions
- What do I end up with?
- A bilingual screen that shows Hindi prose where the API has it, English where it does not, and Hindi labels for computed fields. The code is in Node.js and Python.
- Which endpoints does this recipe call, and in what order?
- 5 endpoints, in this order: Western Personality Report (
POST /v1/western/reports/personality), then Sun Sign Daily Forecast (GET /v1/western/sun-sign/:sign/daily), then Daily Sun Sign Horoscope (GET /v1/horoscope/daily/:sign), then Birth Chart (Kundli) (POST /v1/charts/birth), then AI Astrologer Chat (POST /v1/chat/respond).