DEV Community

Vedika Intelligence
Vedika Intelligence

Posted on • Originally published at vedika.io

Building an Astrology API with 140+ Vedic Endpoints: How We Built Vedika

Every astrology app you've ever used -- Co-Star, The Pattern, AstroSage -- relies on the same foundation: planetary calculations, birth chart analysis, and interpretation logic. Building this from scratch takes 6-12 months and deep expertise in both astronomy and Vedic texts.

We built Vedika so you don't have to.


What is Vedika?

Vedika is a purpose-built astrology intelligence API. It combines Swiss Ephemeris-grade astronomical calculations with an AI interpretation layer that understands natural language questions about birth charts.

Instead of calling 5 separate endpoints and writing interpretation logic yourself, you send one query:

"What are my career prospects this year?"
Enter fullscreen mode Exit fullscreen mode

Vedika figures out which calculations to run (10th house analysis, Mahadasha timing, Jupiter transit, Dashamsha chart), executes them, and returns a coherent answer.

The numbers:

  • 140+ Vedic astrology calculation endpoints
  • 15 Western astrology endpoints
  • AI chatbot supporting 30 languages
  • 65 sandbox endpoints for free testing
  • Sub-200ms response times on calculation endpoints

Architecture: Why This Was Hard to Build

Three things make astrology APIs genuinely difficult:

1. Astronomical Precision

Planetary positions must be accurate to arc-minutes. We use Swiss Ephemeris (the same library used by professional astronomical software) compiled into our backend. Every position is computed in-house -- no external API calls for Vedic calculations.

Swiss Ephemeris -> Julian Day conversion -> Sidereal correction (Lahiri ayanamsa)
-> House calculation (Whole Sign) -> Planetary dignities -> Yoga detection
Enter fullscreen mode Exit fullscreen mode

2. Classical Rule Systems

Vedic astrology has thousands of rules from texts written 2,000+ years ago (BPHS, Phaladeepika, Saravali). Our codebase implements:

  • 21 yoga detection algorithms (Gaja Kesari, Budha-Aditya, Pancha Mahapurusha, etc.)
  • Vimshottari Dasha system with Mahadasha/Antardasha/Pratyantar periods
  • Ashtakavarga scoring across all planets
  • Shadbala (6-fold planetary strength)
  • Mangal Dosha, Kaal Sarp Dosha detection
  • Divisional charts: Navamsa (D9), Dashamsha (D10), and more

Each rule was verified against classical source texts. Not approximated -- verified.

3. Anti-Hallucination

The AI interpretation layer can never contradict computed data. We built a 4-layer validation pipeline:

  1. Chart Summary -- Code-generated markdown with all planetary positions, dignities, aspects, yogas (math only, no AI)
  2. AI Instructions -- 11 mandatory rules the AI must follow (never fabricate yogas, never guess nakshatras)
  3. Mandatory Facts -- Verified data injected into every prompt
  4. Response Validator -- Post-AI checking that catches sign/house/degree errors before delivery

If the AI says "Jupiter is exalted" but the computed data shows Jupiter in Capricorn (debilitated), the validator catches and corrects it.


Code Examples

curl -- Get a Birth Chart

curl -X POST https://api.vedika.io/v2/astrology/birth-chart \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "datetime": "1990-06-15T14:30:00+05:30",
    "latitude": 28.6139,
    "longitude": 77.2090
  }'
Enter fullscreen mode Exit fullscreen mode

Response includes: All 9 planets with sign, house, degree, nakshatra, dignity (exalted/debilitated/own/moolatrikona), retrograde status, combustion flags, plus house cusps and active yogas.

JavaScript SDK

npm install @vedika-io/sdk
Enter fullscreen mode Exit fullscreen mode
import { VedikaClient } from '@vedika-io/sdk';

const client = new VedikaClient({ apiKey: 'vk_live_...' });

// Ask a natural language question
const response = await client.askQuestion({
  question: 'What are my career prospects this year?',
  birthDetails: {
    datetime: '1990-06-15T14:30:00+05:30',
    latitude: 28.6139,
    longitude: 77.2090
  }
});

console.log(response.answer);
// "Your 10th house lord Jupiter is currently transiting through
//  your 9th house, activating a strong Dharma-Karmadhipati yoga..."
Enter fullscreen mode Exit fullscreen mode

Python SDK

pip install vedika-sdk
Enter fullscreen mode Exit fullscreen mode
from vedika import VedikaClient

client = VedikaClient(api_key='vk_live_...')

# Get Kundli matching for matrimonial platforms
match = client.kundli_matching(
    boy_details={
        'datetime': '1992-03-15T10:00:00+05:30',
        'latitude': 19.0760,
        'longitude': 72.8777
    },
    girl_details={
        'datetime': '1994-07-22T14:30:00+05:30',
        'latitude': 28.6139,
        'longitude': 77.2090
    }
)

print(f"Guna Score: {match['gunaScore']}/36")
print(f"Mangal Dosha: Boy={match['boyMangalDosha']}, Girl={match['girlMangalDosha']}")
Enter fullscreen mode Exit fullscreen mode

AI Chat with Streaming (SSE)

const response = await fetch('https://api.vedika.io/api/v1/astrology/query/stream', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'vk_live_...'
  },
  body: JSON.stringify({
    question: 'Explain my current Mahadasha and what to expect',
    birthDetails: {
      datetime: '1995-11-20T08:15:00+05:30',
      latitude: 13.0827,
      longitude: 80.2707
    }
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const chunk = decoder.decode(value);
  process.stdout.write(chunk); // Stream to UI in real-time
}
Enter fullscreen mode Exit fullscreen mode

Key Endpoints

Here's a sampling of what's available:

Category Endpoints What They Calculate
Birth Chart /v2/astrology/birth-chart, /kundli Planets, houses, aspects, yogas
Dasha /v2/astrology/vimshottari-dasha, /antardasha Planetary periods with exact dates
Compatibility /v2/astrology/guna-milan, /ashtakoot-match 36-point Guna matching
Panchang /v2/astrology/panchang, /choghadiya Daily almanac, muhurta timing
Doshas /v2/astrology/mangal-dosha, /kaal-sarp-dosha Dosha detection with remedies
Predictions /v2/astrology/horoscope/daily, /weekly, /monthly AI-generated predictions
Divisional /v2/astrology/navamsa, /dashamsa D9, D10, and other varga charts
Numerology /v2/astrology/numerology/life-path, /destiny Name and date numerology
AI Chat /api/v1/astrology/query Natural language astrology Q&A
Western /v2/western/natal-chart, /transit-chart Tropical zodiac, Western aspects

All endpoints accept the same birth data format. All return structured JSON.


Use Cases (Who's Building With This)

Matrimonial Platforms

Kundli matching is table stakes for Indian matrimonial sites. Vedika's /v2/astrology/guna-milan endpoint returns the 36-point Ashtakoot score, individual Guna breakdowns, Mangal Dosha status for both partners, and compatibility analysis -- in one call.

Horoscope & Rashifal Apps

Daily/weekly/monthly predictions for all 12 signs. The prediction endpoints return structured JSON with scores (1-10) across career, love, health, and finance categories. Perfect for building rashifal sections in news apps or standalone horoscope apps.

Wellness & Spiritual Platforms

Panchang data, muhurta timing, gemstone recommendations, and remedies. Apps like meditation timers and spiritual wellness platforms use this to add personalized astrology features.

AI Chatbot Integrations

The AI chat endpoint turns any app into an astrology consultation platform. Users ask questions in natural language (in 30 languages), and get personalized answers grounded in their actual birth chart data. No astrology knowledge required on your side.

MCP Server for AI Agents

Vedika ships an MCP Server with 22 tools. AI agents in Claude Desktop, Cursor, or Windsurf can natively call astrology calculations:

{
  "mcpServers": {
    "vedika": {
      "command": "npx",
      "args": ["-y", "@vedika-io/mcp-server"],
      "env": { "VEDIKA_API_KEY": "vk_live_your_key_here" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Getting Started

1. Try the Sandbox (No API Key Needed)

65 mock endpoints are available at https://api.vedika.io/sandbox/ for free testing. Same request format as production, realistic response structures.

curl https://api.vedika.io/sandbox/v2/astrology/birth-chart \
  -H "Content-Type: application/json" \
  -d '{"datetime":"1990-01-01T12:00:00+05:30","latitude":28.61,"longitude":77.20}'
Enter fullscreen mode Exit fullscreen mode

2. Get an API Key

Sign up at vedika.io/console to get your vk_live_* API key.

3. Choose Your Plan

Vedika uses a wallet-based credit system:

Plan Monthly Best For
Starter $12/mo Side projects, MVPs
Pro $60/mo Production apps
Business $120/mo High-traffic apps
Enterprise $240/mo Scale platforms

Calculation endpoints cost $0.001-$0.010 per call. AI chat queries cost more (they run actual inference). No surprise bills -- when your wallet hits zero, calls return 402 until you renew.

4. Read the Docs


Build vs. Buy: The Honest Comparison

Factor Build from Scratch Use Vedika API
Development time 6-12 months 30 minutes
Swiss Ephemeris integration Complex C bindings Handled
BPHS rule implementation Months of research 21 yogas pre-built
AI interpretation Train your own model Included
Multi-language Build translation layer 30 languages built-in
Maintenance Ongoing ephemeris updates Handled
Cost $50K-$200K engineering $12/month

If you're building an astrology product, your competitive advantage is the user experience, not the planetary calculation engine. Use Vedika for the hard math. Build the product your users actually want.


Links:

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.