<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vedika Intelligence</title>
    <description>The latest articles on DEV Community by Vedika Intelligence (@vedikaapi).</description>
    <link>https://dev.to/vedikaapi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3721006%2F7cfc844c-7044-4d7f-925a-78dfcb9f9ced.jpeg</url>
      <title>DEV Community: Vedika Intelligence</title>
      <link>https://dev.to/vedikaapi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vedikaapi"/>
    <language>en</language>
    <item>
      <title>Don't Make Users Wait: Building a Real-Time Astrology Reader with SSE and Vedika [2026-06]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 23 Jun 2026 03:30:49 +0000</pubDate>
      <link>https://dev.to/vedikaapi/dont-make-users-wait-building-a-real-time-astrology-reader-with-sse-and-vedika-2026-06-26c2</link>
      <guid>https://dev.to/vedikaapi/dont-make-users-wait-building-a-real-time-astrology-reader-with-sse-and-vedika-2026-06-26c2</guid>
      <description>&lt;p&gt;We’ve all been there. You hit "Generate" on a tool, and for the next five seconds, the page is frozen. A loading spinner spins in a circle while the user wonders if their browser has crashed. In the world of Astrology, where insights are supposed to feel mystical, organic, and unfolding, a wall of static text arriving all at once feels jarring.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Server-Sent Events (SSE)&lt;/strong&gt; come in.&lt;/p&gt;

&lt;p&gt;SSE is a web technology that allows a server to push data to a client in real-time. Unlike WebSockets (which are bi-directional), SSE is perfect for one-way streaming. It's lightweight, built into the browser (&lt;code&gt;EventSource&lt;/code&gt;), and based on standard HTTP, making it incredibly easy to implement.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll build a "Live Natal Chart Interpreter" that streams the AI-generated astrology reading from the &lt;strong&gt;Vedika Astrology API&lt;/strong&gt; to the user in real-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with Synchronous Calls
&lt;/h2&gt;

&lt;p&gt;Let's look at the standard approach. When you call the Vedika API (specifically &lt;code&gt;POST /api/v1/astrology/query&lt;/code&gt;), you typically send a request and wait for a full JSON response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The "Bad" Way (Synchronous feel)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.vedika.io/api/v1/astrology/query&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;What does 2024 hold for me?&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1990-01-01T00:00:00Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;28.6139&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;77.2090&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;insight&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Everything arrives at once&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While this works, the UX is poor. The user has to stare at a blank screen or a spinner. With SSE, we can push the text to the user as the API (or our proxy) generates it, making the experience feel like a living conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Streaming the Insight
&lt;/h2&gt;

&lt;p&gt;We will build a Node.js/Express server that acts as a bridge. The server will call the Vedika API, receive the response, and then "chunk" that response and send it to the client over an SSE connection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Project Setup
&lt;/h3&gt;

&lt;p&gt;First, let's initialize our project and install dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;express cors axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: The Backend (Express + SSE)
&lt;/h3&gt;

&lt;p&gt;We need a route that accepts a POST request and sets the appropriate headers for SSE (&lt;code&gt;Content-Type: text/event-stream&lt;/code&gt; and &lt;code&gt;Cache-Control: no-cache&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Here is the server code (&lt;code&gt;index.js&lt;/code&gt;):&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
const express = require('express');
const axios = require('axios');
const
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>api</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Getting Started with Vedika Astrology API [2026-06]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 16 Jun 2026 03:30:56 +0000</pubDate>
      <link>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-06-5a16</link>
      <guid>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-06-5a16</guid>
      <description>&lt;p&gt;Building astrology features into your app? Here's a quick walkthrough using the Vedika API.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Adding accurate Vedic astrology calculations to your product typically requires deep domain expertise and months of development. Vedika provides a single API endpoint that handles all of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.vedika.io/v2/astrology/kundli &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"datetime": "1990-06-15T10:30:00", "latitude": 12.9716, "longitude": 77.5946, "timezone": "+05:30"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What You Get
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;45+ Vedic astrology endpoints (Kundli, Dasha, Muhurta, matchmaking)&lt;/li&gt;
&lt;li&gt;Swiss Ephemeris precision calculations&lt;/li&gt;
&lt;li&gt;AI-powered interpretations&lt;/li&gt;
&lt;li&gt;Sub-100ms response times&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;The sandbox at &lt;a href="https://vedika.io/sandbox" rel="noopener noreferrer"&gt;vedika.io/sandbox&lt;/a&gt; lets you test all 65 endpoints with mock data — no API key needed.&lt;/p&gt;

&lt;p&gt;Check out the full docs at &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>api</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Getting Started with Vedika Astrology API [2026-04]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 21 Apr 2026 03:31:44 +0000</pubDate>
      <link>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-04-2kbj</link>
      <guid>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-04-2kbj</guid>
      <description>&lt;p&gt;Building astrology features into your app? Here's a quick walkthrough using the Vedika API.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Adding accurate Vedic astrology calculations to your product typically requires deep domain expertise and months of development. Vedika provides a single API endpoint that handles all of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.vedika.io/v2/astrology/kundli &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"datetime": "1990-06-15T10:30:00", "latitude": 12.9716, "longitude": 77.5946, "timezone": "+05:30"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What You Get
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;45+ Vedic astrology endpoints (Kundli, Dasha, Muhurta, matchmaking)&lt;/li&gt;
&lt;li&gt;Swiss Ephemeris precision calculations&lt;/li&gt;
&lt;li&gt;AI-powered interpretations&lt;/li&gt;
&lt;li&gt;Sub-100ms response times&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;The sandbox at &lt;a href="https://vedika.io/sandbox" rel="noopener noreferrer"&gt;vedika.io/sandbox&lt;/a&gt; lets you test all 65 endpoints with mock data — no API key needed.&lt;/p&gt;

&lt;p&gt;Check out the full docs at &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>React + Vedika: Building an Intelligent Horoscope Query Tool in 10 Minutes [2026-04]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 14 Apr 2026 03:30:24 +0000</pubDate>
      <link>https://dev.to/vedikaapi/react-vedika-building-an-intelligent-horoscope-query-tool-in-10-minutes-2026-04-88h</link>
      <guid>https://dev.to/vedikaapi/react-vedika-building-an-intelligent-horoscope-query-tool-in-10-minutes-2026-04-88h</guid>
      <description>&lt;h3&gt;
  
  
  The Problem: Static Text vs. Dynamic AI Insights
&lt;/h3&gt;

&lt;p&gt;Building a web application around astrology used to mean two things: either scraping static horoscope pages (which are often inaccurate and outdated) or building a massive Vedic mathematics engine from scratch (which is computationally expensive and prone to bugs).&lt;/p&gt;

&lt;p&gt;Modern web applications demand dynamic content. Users don't just want to see their "Sun Sign"; they want to know, "Will I get a promotion this year?" or "Should I move to a new city based on my Dasha?".&lt;/p&gt;

&lt;p&gt;This is where the &lt;strong&gt;Vedika API&lt;/strong&gt; comes in. It provides a single, powerful endpoint that uses AI to interpret Vedic astrology charts based on user inputs. In this tutorial, we will integrate this API into a modern React application to create a real-time, interactive astrology query tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before we dive into the code, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Node.js installed.&lt;/li&gt;
&lt;li&gt;  A basic understanding of React Hooks (&lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;  A free API key from the &lt;a href="https://api.vedika.io/sandbox" rel="noopener noreferrer"&gt;Vedika Sandbox&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Step 1: Project Setup
&lt;/h3&gt;

&lt;p&gt;We’ll use Vite for this tutorial because it offers a faster build setup and modern tooling. Open your terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create vite@latest vedika-astro-app &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;span class="nb"&gt;cd &lt;/span&gt;vedika-astro-app
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Understanding the API Payload
&lt;/h3&gt;

&lt;p&gt;The Vedika API expects a specific JSON structure. To use it effectively in React, we need to define our data types.&lt;/p&gt;

&lt;p&gt;According to the documentation, the endpoint is &lt;code&gt;POST /api/v1/astrology/query&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Request Body:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"question"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Will I get a job offer next month?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"birthDetails"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"datetime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1990-05-15T10:30:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ISO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8601&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;format&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;28.6139&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Latitude&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lng"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;77.2090&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Longitude&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Creating a Custom Hook
&lt;/h3&gt;

&lt;p&gt;In a professional React application, we never put API logic directly inside our UI components. Instead, we extract it into a custom hook. This keeps our code clean, reusable, and testable.&lt;/p&gt;

&lt;p&gt;Create a file named &lt;code&gt;useVedikaQuery.js&lt;/code&gt; (or &lt;code&gt;.ts&lt;/code&gt; if you prefer TypeScript).&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
import { useState } from 'react';

const VEDIKA_API_URL = 'https://api.vedika.io/api/v1/astrology/query';

export const useVedikaQuery = () =&amp;gt; {
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState(null);
  const [data, setData] = useState(null);

  const queryAstrology = async (question, birthDetails) =&amp;gt; {
    setLoading(true);
    setError(null);

    try {
      const response = await fetch(VEDIKA_API_URL, {
        method: 'POST',
        headers: {
          'Content
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Stop Guessing Your JSON: Building Type-Safe APIs with TypeScript and Vedika [2026-04]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 07 Apr 2026 03:30:28 +0000</pubDate>
      <link>https://dev.to/vedikaapi/stop-guessing-your-json-building-type-safe-apis-with-typescript-and-vedika-2026-04-1d8p</link>
      <guid>https://dev.to/vedikaapi/stop-guessing-your-json-building-type-safe-apis-with-typescript-and-vedika-2026-04-1d8p</guid>
      <description>&lt;p&gt;If you’ve been writing TypeScript for any amount of time, you know the pain of the &lt;code&gt;any&lt;/code&gt; keyword. It’s the siren song of convenience—easy to type, but a disaster waiting to happen at runtime. One day, your API returns a string when you expect an object, or a field you thought was required is suddenly missing.&lt;/p&gt;

&lt;p&gt;When integrating with external APIs, especially AI-driven ones, this uncertainty is amplified. The response structure might be complex, nested, or evolve without notice. This is where TypeScript shines. It allows us to define a contract &lt;em&gt;before&lt;/em&gt; the data hits the wire, ensuring our application is robust, maintainable, and predictable.&lt;/p&gt;

&lt;p&gt;In this article, we’ll integrate the &lt;strong&gt;Vedika Astrology API&lt;/strong&gt; into a TypeScript application. We will focus on the "how" and the "why," demonstrating how to build a type-safe client that queries for astrological insights based on birth details.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;Before we write any code, we need a target. The Vedika API is an AI-powered Vedic astrology service. It requires a single endpoint, &lt;code&gt;POST /api/v1/astrology/query&lt;/code&gt;, which takes a question and birth details to generate a reading.&lt;/p&gt;

&lt;p&gt;For this example, we’ll assume you have a Node.js environment set up. Create a new folder, initialize a project, and install &lt;code&gt;fetch&lt;/code&gt; (built-in in Node 18+) or &lt;code&gt;axios&lt;/code&gt;. For strict typing, we’ll stick to the native &lt;code&gt;fetch&lt;/code&gt; API to keep dependencies low.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;vedika-ts-client
&lt;span class="nb"&gt;cd &lt;/span&gt;vedika-ts-client
npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1: Define Your Types
&lt;/h2&gt;

&lt;p&gt;The first rule of TypeScript integration is: &lt;strong&gt;Define the Shape.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to map the JSON structure of the Vedika API request and response to TypeScript interfaces. This happens in two parts: defining the &lt;em&gt;Request&lt;/em&gt; payload and defining the &lt;em&gt;Response&lt;/em&gt; payload.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.1 The Request Interface
&lt;/h3&gt;

&lt;p&gt;The API requires a &lt;code&gt;question&lt;/code&gt; (string) and a &lt;code&gt;birthDetails&lt;/code&gt; object. The &lt;code&gt;birthDetails&lt;/code&gt; object needs a &lt;code&gt;datetime&lt;/code&gt; (ISO 8601 string), latitude, and longitude.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// types.ts&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ISO 8601 format, e.g., "2000-01-01T12:00:00Z"&lt;/span&gt;
  &lt;span class="nl"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AstrologyQueryRequest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1.2 The Response Interface
&lt;/h3&gt;

&lt;p&gt;The API returns a JSON object. While the exact field names might vary slightly depending on the specific AI model version, we anticipate a structure containing an &lt;code&gt;insight&lt;/code&gt; field and metadata.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AstrologyResponse&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;insight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// Future-proofing: Adding other potential fields as comments&lt;/span&gt;
  &lt;span class="c1"&gt;// timestamp?: number;&lt;/span&gt;
  &lt;span class="c1"&gt;// confidence?: number;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By defining these interfaces, we gain immediate feedback. If you misspell &lt;code&gt;datetime&lt;/code&gt; as &lt;code&gt;date&lt;/code&gt;, TypeScript will scream at you immediately in your IDE.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Implementing the Client
&lt;/h2&gt;

&lt;p&gt;Now that our types are defined, we can build the client. We will create a function that accepts the &lt;code&gt;AstrologyQueryRequest&lt;/code&gt;, sends&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>api</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Stop Burning API Quotas: A Practical Guide to Caching the Vedika Astrology API [2026-03]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 31 Mar 2026 03:30:36 +0000</pubDate>
      <link>https://dev.to/vedikaapi/stop-burning-api-quotas-a-practical-guide-to-caching-the-vedika-astrology-api-2026-03-21b5</link>
      <guid>https://dev.to/vedikaapi/stop-burning-api-quotas-a-practical-guide-to-caching-the-vedika-astrology-api-2026-03-21b5</guid>
      <description>&lt;p&gt;Astrology applications are a goldmine for developers, but they are also a nightmare for API budgets. Why? Because every single user query triggers an AI generation process.&lt;/p&gt;

&lt;p&gt;Imagine a user asking: &lt;em&gt;"Will I get married?"&lt;/em&gt; followed by &lt;em&gt;"When?"&lt;/em&gt; and &lt;em&gt;"Who will I marry?"&lt;/em&gt; If you fetch the answer from the Vedika API for every single request, you are paying for the same AI processing three times.&lt;/p&gt;

&lt;p&gt;In this article, we will solve this performance bottleneck by implementing robust caching strategies for the Vedika Astrology API. We'll move from simple in-memory caching to time-based expiration, ensuring your app is fast, cost-effective, and scalable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Why We Can't Just "Fetch and Forget"
&lt;/h2&gt;

&lt;p&gt;The Vedika API is powerful. It uses advanced Vedic astrological principles and AI to generate personalized insights. However, this comes at a cost.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Latency:&lt;/strong&gt; AI generation takes time. Waiting 2-3 seconds for every query degrades the user experience.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Cost:&lt;/strong&gt; Every request to the AI model consumes credits. Repetitive queries (like a user refreshing their dashboard) drain your budget.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Scalability:&lt;/strong&gt; As traffic increases, your backend servers will spend more time waiting for external API responses instead of serving users.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The solution? &lt;strong&gt;Caching&lt;/strong&gt;. We store the result of a query locally (or in a database) so we can return it instantly if the same question is asked again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Simple In-Memory Caching
&lt;/h2&gt;

&lt;p&gt;The easiest way to start is with in-memory caching. In Node.js, we can use a &lt;code&gt;Map&lt;/code&gt; object to store our results.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Logic
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; Check if the answer exists in the &lt;code&gt;Map&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; If yes, return the cached data immediately.&lt;/li&gt;
&lt;li&gt; If no, call the Vedika API, save the response to the &lt;code&gt;Map&lt;/code&gt;, and then return it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Code
&lt;/h3&gt;

&lt;p&gt;Here is a TypeScript implementation using the Vedika endpoint (&lt;code&gt;POST /api/v1/astrology/query&lt;/code&gt;).&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
interface BirthDetails {
  datetime: string;
  lat: number;
  lng: number;
}

interface AstrologyResponse {
  insight: string;
  confidence: number;
}

class AstrologyService {
  private cache = new Map&amp;lt;string, AstrologyResponse&amp;gt;();

  // A helper to generate a unique key from the user's query
  private generateCacheKey(question: string, birthDetails: BirthDetails): string {
    // We normalize the input so "Will I get married?" and "Will I get married?" 
    // are treated as the same query.
    return `${question}-${birthDetails.datetime}`;
  }

  public async getInsight(
    question: string, 
    birthDetails: BirthDetails
  ): Promise&amp;lt;AstrologyResponse&amp;gt; {
    const cacheKey = this.generateCacheKey(question, birthDetails);

    // 1. Check Cache
    if (this.cache.has(cacheKey)) {
      console.log(`[Cache Hit] Returning data for: ${question}`);
      return this.cache.get(cacheKey)!;
    }

    console.log(`[Cache Miss] Fetching from Vedika API for: ${question}`);

    // 2. Fetch from API
    // Note: In
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>api</category>
      <category>performance</category>
      <category>webdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>From Zero to Horoscope: Building a TypeScript Client for Vedic Astrology [2026-03]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 24 Mar 2026 03:30:31 +0000</pubDate>
      <link>https://dev.to/vedikaapi/from-zero-to-horoscope-building-a-typescript-client-for-vedic-astrology-2026-03-1789</link>
      <guid>https://dev.to/vedikaapi/from-zero-to-horoscope-building-a-typescript-client-for-vedic-astrology-2026-03-1789</guid>
      <description>&lt;p&gt;When we talk about API integration in TypeScript, we rarely discuss the mystical. Usually, it’s CRUD operations, financial data, or weather forecasts. But sometimes, you want to build something a little more... esoteric.&lt;/p&gt;

&lt;p&gt;Enter the &lt;strong&gt;Vedika API&lt;/strong&gt;. It’s an AI-powered Vedic astrology service. It solves a specific problem: you feed it a question and a birth chart (date, time, location), and it generates an AI-driven insight.&lt;/p&gt;

&lt;p&gt;For a TypeScript developer, integrating this isn't just about making a POST request. It's about rigorously defining the shape of the cosmos (and the data) before you actually ask it a question.&lt;/p&gt;

&lt;p&gt;In this post, we’ll build a type-safe client from scratch. We’ll focus on how to structure your interfaces, handle async operations, and catch the edge cases that usually break production apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: The "Any" Trap
&lt;/h2&gt;

&lt;p&gt;Before we write code, let’s look at the friction point. If you simply use &lt;code&gt;any&lt;/code&gt; in TypeScript, you bypass the compiler's safety net.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ The dangerous way&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getHoroscope&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// TypeScript thinks data is any&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 💥 Runtime crash if the API changes&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the API response structure shifts slightly (which happens often during AI model training), your app crashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Strongly Typed Interfaces
&lt;/h2&gt;

&lt;p&gt;The Vedika API has a single endpoint: &lt;code&gt;POST /api/v1/astrology/query&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make this robust, we need to define what the input looks like and what the output looks like.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Defining the Data Shapes
&lt;/h3&gt;

&lt;p&gt;First, let's define the input structure. The API expects a &lt;code&gt;question&lt;/code&gt; string and a &lt;code&gt;birthDetails&lt;/code&gt; object containing date, latitude, and longitude.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// types.ts&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Represents the geographic location of birth.
 * Using strict number types for coordinates.
 */&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ISO 8601 format: YYYY-MM-DD&lt;/span&gt;
  &lt;span class="nl"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ISO 8601 format: HH:mm:ss&lt;/span&gt;
  &lt;span class="nl"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * The request payload for the Vedika API.
 */&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AstrologyQueryRequest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * The expected response structure from Vedika.
 * We use 'unknown' initially to force us to handle the data explicitly.
 */&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;AstrologyResponse&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;planetary_positions&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;remedial_measures&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="nl"&gt;error&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice we used &lt;code&gt;string&lt;/code&gt; for dates. In JSON (which APIs communicate over), dates are rarely objects. They are serialized strings. If we tried to use a native &lt;code&gt;Date&lt;/code&gt; object in the interface, we would have to deal with serialization logic manually every time we sent the request.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The Client Class
&lt;/h3&gt;

&lt;p&gt;Now, let's wrap the &lt;code&gt;fetch&lt;/code&gt; logic in a class. This encapsulates our configuration and error handling.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>api</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Building an AI-Powered Astrology Dashboard in React: A Practical Guide [2026-03]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 17 Mar 2026 03:31:05 +0000</pubDate>
      <link>https://dev.to/vedikaapi/building-an-ai-powered-astrology-dashboard-in-react-a-practical-guide-2026-03-3hg0</link>
      <guid>https://dev.to/vedikaapi/building-an-ai-powered-astrology-dashboard-in-react-a-practical-guide-2026-03-3hg0</guid>
      <description>&lt;p&gt;The intersection of traditional knowledge and modern technology has always been fascinating. In the world of Vedic astrology, this intersection is currently being revolutionized by Artificial Intelligence. But for frontend developers, integrating complex logic like planetary calculations and predictive analytics can be a nightmare.&lt;/p&gt;

&lt;p&gt;You don't want to build a physics engine to calculate the position of Jupiter in the sign of Cancer based on a user's birth time and location. You want to focus on the UI and the user experience.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Vedika&lt;/strong&gt; comes in. Vedika is an AI-powered Vedic astrology API that abstracts away the complexity. It takes simple inputs—like a question and birth details—and returns AI-generated insights.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will build a sleek, functional React application that queries the Vedika API to generate personalized astrological readings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we dive in, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Node.js&lt;/strong&gt; installed on your machine.&lt;/li&gt;
&lt;li&gt;  Basic knowledge of &lt;strong&gt;React&lt;/strong&gt; and hooks (&lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;  An API key from the &lt;a href="https://api.vedika.io/sandbox" rel="noopener noreferrer"&gt;Vedika Sandbox&lt;/a&gt; (it's free and requires no credit card).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Project Initialization
&lt;/h2&gt;

&lt;p&gt;Let's kick things off by setting up a standard React project using Vite. It’s faster and more modern than Create React App.&lt;/p&gt;

&lt;p&gt;Open your terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create vite@latest vedika-dashboard &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;span class="nb"&gt;cd &lt;/span&gt;vedika-dashboard
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's focus on the logic. We need a dedicated file to handle our API communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: The API Client
&lt;/h2&gt;

&lt;p&gt;The Vedika API is simple: a single &lt;code&gt;POST&lt;/code&gt; endpoint at &lt;code&gt;/api/v1/astrology/query&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We need to construct the request body carefully. Based on the Vedika documentation, the input expects a &lt;code&gt;question&lt;/code&gt; string and a &lt;code&gt;birthDetails&lt;/code&gt; object containing &lt;code&gt;datetime&lt;/code&gt;, &lt;code&gt;lat&lt;/code&gt;, and &lt;code&gt;lng&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a new file named &lt;code&gt;vedikaService.js&lt;/code&gt; in your &lt;code&gt;src&lt;/code&gt; folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/vedikaService.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SANDBOX_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.vedika.io/api/v1/astrology/query&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;queryVedika&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SANDBOX_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// In production, you would use a real API key here&lt;/span&gt;
        &lt;span class="c1"&gt;// 'Authorization': 'Bearer YOUR_API_KEY'&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Format: YYYY-MM-DDTHH:mm&lt;/span&gt;
          &lt;span class="na"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lng&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`API Error: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Vedika API Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Notice that we are using the &lt;code&gt;SANDBOX_URL&lt;/code&gt;. The documentation states that the sandbox&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Building an Astrology API with 140+ Vedic Endpoints: How We Built Vedika</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Sat, 14 Mar 2026 02:18:46 +0000</pubDate>
      <link>https://dev.to/vedikaapi/building-an-astrology-api-with-140-vedic-endpoints-how-we-built-vedika-3bp6</link>
      <guid>https://dev.to/vedikaapi/building-an-astrology-api-with-140-vedic-endpoints-how-we-built-vedika-3bp6</guid>
      <description>&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;We built Vedika so you don't have to.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Vedika?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://vedika.io" rel="noopener noreferrer"&gt;Vedika&lt;/a&gt; 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.&lt;/p&gt;

&lt;p&gt;Instead of calling 5 separate endpoints and writing interpretation logic yourself, you send one query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"What are my career prospects this year?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;The numbers:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;140+ Vedic astrology calculation endpoints&lt;/li&gt;
&lt;li&gt;15 Western astrology endpoints&lt;/li&gt;
&lt;li&gt;AI chatbot supporting 30 languages&lt;/li&gt;
&lt;li&gt;65 sandbox endpoints for free testing&lt;/li&gt;
&lt;li&gt;Sub-200ms response times on calculation endpoints&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Architecture: Why This Was Hard to Build
&lt;/h2&gt;

&lt;p&gt;Three things make astrology APIs genuinely difficult:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Astronomical Precision
&lt;/h3&gt;

&lt;p&gt;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.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Swiss Ephemeris -&amp;gt; Julian Day conversion -&amp;gt; Sidereal correction (Lahiri ayanamsa)
-&amp;gt; House calculation (Whole Sign) -&amp;gt; Planetary dignities -&amp;gt; Yoga detection
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Classical Rule Systems
&lt;/h3&gt;

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

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

&lt;p&gt;Each rule was verified against classical source texts. Not approximated -- verified.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Anti-Hallucination
&lt;/h3&gt;

&lt;p&gt;The AI interpretation layer can never contradict computed data. We built a 4-layer validation pipeline:&lt;/p&gt;

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

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




&lt;h2&gt;
  
  
  Code Examples
&lt;/h2&gt;

&lt;h3&gt;
  
  
  curl -- Get a Birth Chart
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.vedika.io/v2/astrology/birth-chart &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_API_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "datetime": "1990-06-15T14:30:00+05:30",
    "latitude": 28.6139,
    "longitude": 77.2090
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  JavaScript SDK
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @vedika-io/sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;VedikaClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@vedika-io/sdk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;VedikaClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vk_live_...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Ask a natural language question&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;askQuestion&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;What are my career prospects this year?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1990-06-15T14:30:00+05:30&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;latitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;28.6139&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;longitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;77.2090&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;answer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// "Your 10th house lord Jupiter is currently transiting through&lt;/span&gt;
&lt;span class="c1"&gt;//  your 9th house, activating a strong Dharma-Karmadhipati yoga..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Python SDK
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;vedika-sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;vedika&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;VedikaClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;VedikaClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;vk_live_...&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Get Kundli matching for matrimonial platforms
&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;kundli_matching&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;boy_details&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;datetime&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1992-03-15T10:00:00+05:30&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;latitude&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;19.0760&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;longitude&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;72.8777&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;girl_details&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;datetime&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1994-07-22T14:30:00+05:30&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;latitude&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;28.6139&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;longitude&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;77.2090&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Guna Score: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;gunaScore&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/36&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mangal Dosha: Boy=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;boyMangalDosha&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, Girl=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;girlMangalDosha&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  AI Chat with Streaming (SSE)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.vedika.io/api/v1/astrology/query/stream&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vk_live_...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Explain my current Mahadasha and what to expect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1995-11-20T08:15:00+05:30&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;latitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;13.0827&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;longitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;80.2707&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getReader&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;decoder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TextDecoder&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chunk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;decoder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Stream to UI in real-time&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Key Endpoints
&lt;/h2&gt;

&lt;p&gt;Here's a sampling of what's available:&lt;/p&gt;

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

&lt;p&gt;All endpoints accept the same birth data format. All return structured JSON.&lt;/p&gt;




&lt;h2&gt;
  
  
  Use Cases (Who's Building With This)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Matrimonial Platforms
&lt;/h3&gt;

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

&lt;h3&gt;
  
  
  Horoscope &amp;amp; Rashifal Apps
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wellness &amp;amp; Spiritual Platforms
&lt;/h3&gt;

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

&lt;h3&gt;
  
  
  AI Chatbot Integrations
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP Server for AI Agents
&lt;/h3&gt;

&lt;p&gt;Vedika ships an &lt;a href="https://www.npmjs.com/package/@vedika-io/mcp-server" rel="noopener noreferrer"&gt;MCP Server&lt;/a&gt; with 22 tools. AI agents in Claude Desktop, Cursor, or Windsurf can natively call astrology calculations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"vedika"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"@vedika-io/mcp-server"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"VEDIKA_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vk_live_your_key_here"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Try the Sandbox (No API Key Needed)
&lt;/h3&gt;

&lt;p&gt;65 mock endpoints are available at &lt;code&gt;https://api.vedika.io/sandbox/&lt;/code&gt; for free testing. Same request format as production, realistic response structures.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.vedika.io/sandbox/v2/astrology/birth-chart &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"datetime":"1990-01-01T12:00:00+05:30","latitude":28.61,"longitude":77.20}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Get an API Key
&lt;/h3&gt;

&lt;p&gt;Sign up at &lt;a href="https://vedika.io/console" rel="noopener noreferrer"&gt;vedika.io/console&lt;/a&gt; to get your &lt;code&gt;vk_live_*&lt;/code&gt; API key.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Choose Your Plan
&lt;/h3&gt;

&lt;p&gt;Vedika uses a wallet-based credit system:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;th&gt;Monthly&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Starter&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$12/mo&lt;/td&gt;
&lt;td&gt;Side projects, MVPs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pro&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$60/mo&lt;/td&gt;
&lt;td&gt;Production apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Business&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$120/mo&lt;/td&gt;
&lt;td&gt;High-traffic apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Enterprise&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$240/mo&lt;/td&gt;
&lt;td&gt;Scale platforms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Read the Docs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API Reference&lt;/strong&gt;: &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript SDK&lt;/strong&gt;: &lt;a href="https://www.npmjs.com/package/@vedika-io/sdk" rel="noopener noreferrer"&gt;@vedika-io/sdk on npm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python SDK&lt;/strong&gt;: &lt;a href="https://pypi.org/project/vedika-sdk/" rel="noopener noreferrer"&gt;vedika-sdk on PyPI&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP Server&lt;/strong&gt;: &lt;a href="https://www.npmjs.com/package/@vedika-io/mcp-server" rel="noopener noreferrer"&gt;@vedika-io/mcp-server on npm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/vedika-io" rel="noopener noreferrer"&gt;github.com/vedika-io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Build vs. Buy: The Honest Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Build from Scratch&lt;/th&gt;
&lt;th&gt;Use Vedika API&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Development time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;6-12 months&lt;/td&gt;
&lt;td&gt;30 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Swiss Ephemeris integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Complex C bindings&lt;/td&gt;
&lt;td&gt;Handled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;BPHS rule implementation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Months of research&lt;/td&gt;
&lt;td&gt;21 yogas pre-built&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI interpretation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Train your own model&lt;/td&gt;
&lt;td&gt;Included&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multi-language&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Build translation layer&lt;/td&gt;
&lt;td&gt;30 languages built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Maintenance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ongoing ephemeris updates&lt;/td&gt;
&lt;td&gt;Handled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$50K-$200K engineering&lt;/td&gt;
&lt;td&gt;$12/month&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;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.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website: &lt;a href="https://vedika.io" rel="noopener noreferrer"&gt;vedika.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;API Console: &lt;a href="https://vedika.io/console" rel="noopener noreferrer"&gt;vedika.io/console&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/vedika-io" rel="noopener noreferrer"&gt;github.com/vedika-io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>astrology</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Getting Started with Vedika Astrology API [2026-03]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 10 Mar 2026 03:31:49 +0000</pubDate>
      <link>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-03-22k</link>
      <guid>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-03-22k</guid>
      <description>&lt;p&gt;Building astrology features into your app? Here's a quick walkthrough using the Vedika API.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Adding accurate Vedic astrology calculations to your product typically requires deep domain expertise and months of development. Vedika provides a single API endpoint that handles all of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.vedika.io/v2/astrology/kundli &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"datetime": "1990-06-15T10:30:00", "latitude": 12.9716, "longitude": 77.5946, "timezone": "+05:30"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What You Get
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;45+ Vedic astrology endpoints (Kundli, Dasha, Muhurta, matchmaking)&lt;/li&gt;
&lt;li&gt;Swiss Ephemeris precision calculations&lt;/li&gt;
&lt;li&gt;AI-powered interpretations&lt;/li&gt;
&lt;li&gt;Sub-100ms response times&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;The sandbox at &lt;a href="https://vedika.io/sandbox" rel="noopener noreferrer"&gt;vedika.io/sandbox&lt;/a&gt; lets you test all 65 endpoints with mock data — no API key needed.&lt;/p&gt;

&lt;p&gt;Check out the full docs at &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>api</category>
      <category>performance</category>
      <category>webdev</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Getting Started with Vedika Astrology API [2026-03]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 03 Mar 2026 03:30:21 +0000</pubDate>
      <link>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-03-2e50</link>
      <guid>https://dev.to/vedikaapi/getting-started-with-vedika-astrology-api-2026-03-2e50</guid>
      <description>&lt;p&gt;Building astrology features into your app? Here's a quick walkthrough using the Vedika API.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Adding accurate Vedic astrology calculations to your product typically requires deep domain expertise and months of development. Vedika provides a single API endpoint that handles all of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.vedika.io/v2/astrology/kundli &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x-api-key: YOUR_KEY"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"datetime": "1990-06-15T10:30:00", "latitude": 12.9716, "longitude": 77.5946, "timezone": "+05:30"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What You Get
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;45+ Vedic astrology endpoints (Kundli, Dasha, Muhurta, matchmaking)&lt;/li&gt;
&lt;li&gt;Swiss Ephemeris precision calculations&lt;/li&gt;
&lt;li&gt;AI-powered interpretations&lt;/li&gt;
&lt;li&gt;Sub-100ms response times&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Free
&lt;/h2&gt;

&lt;p&gt;The sandbox at &lt;a href="https://vedika.io/sandbox" rel="noopener noreferrer"&gt;vedika.io/sandbox&lt;/a&gt; lets you test all 65 endpoints with mock data — no API key needed.&lt;/p&gt;

&lt;p&gt;Check out the full docs at &lt;a href="https://vedika.io/docs" rel="noopener noreferrer"&gt;vedika.io/docs&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>api</category>
      <category>performance</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Beyond JSON: Building Type-Safe API Integrations with TypeScript and Vedika [2026-02]</title>
      <dc:creator>Vedika Intelligence</dc:creator>
      <pubDate>Tue, 24 Feb 2026 03:30:45 +0000</pubDate>
      <link>https://dev.to/vedikaapi/beyond-json-building-type-safe-api-integrations-with-typescript-and-vedika-2026-02-1f45</link>
      <guid>https://dev.to/vedikaapi/beyond-json-building-type-safe-api-integrations-with-typescript-and-vedika-2026-02-1f45</guid>
      <description>&lt;p&gt;When we start building applications, we often treat API integration as a simple "fetch and print" task. We send a JSON object, get a JSON response, and move on. However, as applications grow, relying on loose typing (&lt;code&gt;any&lt;/code&gt;) leads to runtime errors that are incredibly frustrating to debug.&lt;/p&gt;

&lt;p&gt;In this article, we’re going to build a robust, type-safe integration for the &lt;strong&gt;Vedika Astrology API&lt;/strong&gt;. While the domain (Vedic astrology) might seem niche, the technical requirements—specifically handling datetime objects, geospatial coordinates, and unstructured AI responses—make it a perfect playground for demonstrating TypeScript's power.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: The "Any" Trap
&lt;/h3&gt;

&lt;p&gt;Consider a naive implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/astrology&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;When will I get a promotion?&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// What type is this? What happens if I miss a field?&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;insights&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Runtime crash if 'insights' is missing&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code is brittle. If you misspell &lt;code&gt;insights&lt;/code&gt; as &lt;code&gt;insights&lt;/code&gt;, TypeScript won't stop you, and you’ll get a runtime error. If the API changes its structure, your code breaks silently until a user encounters the issue.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: Strict Interfaces
&lt;/h3&gt;

&lt;p&gt;To solve this, we must define exactly what the API expects and what it returns. We will use TypeScript interfaces to enforce this contract.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Define the Data Structures
&lt;/h4&gt;

&lt;p&gt;Vedika requires two main inputs: a &lt;code&gt;question&lt;/code&gt; string and &lt;code&gt;birthDetails&lt;/code&gt; (which includes a datetime, latitude, and longitude).&lt;/p&gt;

&lt;p&gt;First, let's define the &lt;code&gt;BirthDetails&lt;/code&gt; interface. This ensures we capture the location and time accurately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ISO 8601 format is standard&lt;/span&gt;
  &lt;span class="nl"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's define the request payload.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;VedikaQueryInput&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;birthDetails&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BirthDetails&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Define the Response Schema
&lt;/h4&gt;

&lt;p&gt;The API returns an AI-generated response. We need to anticipate what that looks like. We'll define an interface for the root response, likely containing an array of &lt;code&gt;insights&lt;/code&gt; or an &lt;code&gt;analysis&lt;/code&gt; object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;VedikaResponse&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;success&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;insights&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[];&lt;/span&gt; &lt;span class="c1"&gt;// Array of string insights&lt;/span&gt;
    &lt;span class="nl"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;error&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: The Type-Safe Client
&lt;/h4&gt;

&lt;p&gt;Now, let's build the actual function. We will wrap the native &lt;code&gt;fetch&lt;/code&gt; API in a typed function. This acts as our client, handling the networking and ensuring type safety at the boundary.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
const API_BASE_URL = 'https
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>api</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
