Skip to content

goyalsoftech/aiastroapi-sdk-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

AiAstroAPI Node.js SDK

The official Node.js / TypeScript client library for AiAstroAPI — a high-precision Vedic Astrology, Panchang, and planetary computing engine.

Get instant, type-safe access to birth charts (D1-D60), Vimshottari Dashas, Ashtakoot/Dashakoot matchmaking, transit tracking, and AI-powered readings.


Installation

Install the package via npm:

npm install @aiastroapi/sdk

Or via yarn / pnpm:

yarn add @aiastroapi/sdk
# or
pnpm add @aiastroapi/sdk

Quickstart

Initialize the AiAstroClient with your API key.

import { AiAstroClient } from '@aiastroapi/sdk';

const client = new AiAstroClient({
    apiKey: 'YOUR_API_KEY'
});

Code Examples

The SDK supports clean, object-based parameter calls. Define your parameters once and reuse them across multiple calculations.

1. Planetary Positions & Panchang

import { AiAstroClient } from '@aiastroapi/sdk';

const client = new AiAstroClient({ apiKey: 'YOUR_API_KEY' });

// Define birth details configuration
const birthDetails = {
  year: 1991,
  month: 1,
  day: 1,
  hour: 12,
  min: 0,
  lat: 23.179,
  lon: 75.785,
  tz: 5.5
};

// Fetch planet details
const planets = await client.getPlanets(birthDetails);
console.log("Ascendant Sign:", planets[0].sign);

// Fetch Panchang details
const panchang = await client.getPanchang(birthDetails);
console.log("Nakshatra of the day:", panchang.nakshatra);

2. Divisional Charts (D1 - D60)

Fetch raw calculations or beautifully styled SVG representations for divisional charts:

// 1. Fetch raw JSON calculations
const d9Data = await client.getChartData(birthDetails, 'D9');

// 2. Fetch SVG representation (supports 'north' / 'south' styles)
const d10Svg = await client.getChartSvg(birthDetails, 'D10', 'north');

3. Ashtakoot / Dashakoot Match Making

For matchmaking, group parameters under male and female keys:

const matchParams = {
  male: {
    year: 1991, month: 1, day: 1, hour: 12, min: 0, lat: 23.179, lon: 75.785, tz: 5.5
  },
  female: {
    year: 1994, month: 5, day: 14, hour: 10, min: 30, lat: 18.9, lon: 72.8, tz: 5.5
  }
};

const compatibility = await client.getAshtakootMatch(matchParams);
console.log("Match compatibility points (out of 36):", compatibility.ashtakoot_points);

4. AI Astrological Insights (Powered by LLMs)

Generate contextual readings directly through the production worker pipeline:

const careerReport = await client.getAiReport('career', birthDetails);
console.log(careerReport.ai_prediction);

Error Handling

The SDK throws structured errors for bad requests, invalid parameters, or authentication failures. It is highly recommended to wrap requests in standard try/catch blocks:

try {
  const result = await client.getPanchang({
    year: 1991,
    month: 1,
    day: 35, // <-- Invalid day parameter!
    lat: 23.179,
    lon: 75.785,
    tz: 5.5
  });
} catch (error) {
  console.error("API Request Failed:", error.message);
}

Resources & Links

About

Oficial Github Repo for Node.js SDK for AiAstroAPI

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors