@vedika-io/sdk
v2.3.0
Published
The only B2B astrology API with AI-powered chatbot queries - JavaScript/Node.js SDK
Maintainers
Readme
Vedika JavaScript/Node.js SDK
Official JavaScript/Node.js SDK for the Vedika Astrology API - The only B2B astrology API with AI-powered chatbot queries.
🌟 What Makes Vedika Unique?
Vedika is the ONLY B2B astrology API that offers:
- ✅ AI-Powered Chatbot Queries (conversational astrology questions)
- ✅ Advanced Multi-Model AI (intelligent query routing)
- ✅ Voice AI (v33: 3-tier voice interface with 22-language multilingual support)
- ✅ Fast & Standard Speed Modes (1.5-3s fast queries vs 12-18s comprehensive)
- ✅ Multi-Turn Conversations (maintain context via conversationId)
- ✅ 108+ Traditional Features (birth charts, dashas, yogas, doshas, compatibility)
- ✅ 97.2% Prediction Accuracy (vs 51% industry average)
- ✅ 99.9% Uptime (3-tier ephemeris fallback)
- ✅ 22 Language Support (including 11 Indian languages)
In summary: All the features of traditional astrology APIs, PLUS conversational AI capabilities no other provider has.
🚀 Quick Start
Installation
npm install vedika-sdk
# or
yarn add vedika-sdkBasic Usage (Node.js)
const { VedikaClient } = require('vedika-sdk');
// Initialize client
const client = new VedikaClient({
apiKey: 'vk_test_your_api_key_here'
});
// Ask a conversational astrology question (UNIQUE to Vedika!)
const response = await client.askQuestion({
question: 'What are my career prospects for this year?',
birthDetails: {
datetime: '1990-06-15T14:30:00+05:30',
latitude: 28.6139,
longitude: 77.2090,
timezone: '+05:30'
},
language: 'en', // Supports 22 languages!
speed: 'standard' // 'fast' (1.5-3s) or 'standard' (12-18s, default)
});
console.log(response.answer);
console.log(`Confidence: ${response.confidence}`);
console.log(`Credits used: ${response.creditsUsed}`);
console.log(`Conversation ID: ${response.conversationId}`); // Use for multi-turn
// Continue conversation
const followUp = await client.askQuestion({
question: 'Tell me about my marriage prospects',
birthDetails: response.birthDetails,
conversationId: response.conversationId // Maintains context
});ES6 Modules
import { VedikaClient } from 'vedika-sdk';
const client = new VedikaClient({ apiKey: 'vk_test_...' });
// Use async/await
const response = await client.askQuestion({
question: 'When should I start my new business?',
birthDetails: { /* ... */ }
});React Example
import { VedikaClient } from 'vedika-sdk';
import { useState } from 'react';
function AstrologyChat() {
const [answer, setAnswer] = useState('');
const client = new VedikaClient({ apiKey: process.env.REACT_APP_VEDIKA_API_KEY });
const askQuestion = async (question) => {
const response = await client.askQuestion({
question,
birthDetails: {
datetime: '1990-06-15T14:30:00+05:30',
latitude: 28.6139,
longitude: 77.2090,
timezone: '+05:30'
}
});
setAnswer(response.answer);
};
return (
<div>
<button onClick={() => askQuestion('What are my career prospects?')}>
Ask AI Astrologer
</button>
<p>{answer}</p>
</div>
);
}📚 Features
🤖 AI Chatbot Queries (Unique Feature!)
// Conversational astrology - No other API has this!
const response = await client.askQuestion({
question: 'When should I start my new business?',
birthDetails: birthInfo,
language: 'hi' // Ask in Hindi!
});📊 Birth Chart Analysis
// Generate complete birth chart
const chart = await client.getBirthChart({
datetime: '1990-06-15T14:30:00+05:30',
latitude: 28.6139,
longitude: 77.2090,
ayanamsa: 'lahiri' // 8 ayanamsa systems supported
});
console.log(chart.planets);
console.log(chart.houses);
console.log(chart.ascendant);🔮 Dasha Periods
// Get Vimshottari Dasha periods
const dashas = await client.getDashas({ birthDetails: birthInfo });
dashas.mahadashas.forEach(dasha => {
console.log(`${dasha.planet}: ${dasha.startDate} to ${dasha.endDate}`);
});💑 Compatibility Analysis
// Ashtakoota matching for marriage compatibility
const compatibility = await client.checkCompatibility({
person1: birthInfo1,
person2: birthInfo2
});
console.log(`Total score: ${compatibility.totalScore}/36`);
console.log(`Compatibility: ${compatibility.level}`);🌟 Yoga Detection
// Detect 300+ astrological yogas
const yogas = await client.detectYogas({ birthDetails: birthInfo });
console.log(`Found ${yogas.yogas.length} yogas:`);
yogas.yogas.forEach(yoga => {
console.log(`- ${yoga.name}: ${yoga.description}`);
});⚠️ Dosha Analysis
// Check for Kaal Sarp, Mangal, Sade Sati doshas
const doshas = await client.analyzeDoshas({ birthDetails: birthInfo });
if (doshas.kaalSarpDosha.present) {
console.log('Kaal Sarp Dosha detected');
console.log(`Type: ${doshas.kaalSarpDosha.type}`);
console.log(`Remedies: ${doshas.kaalSarpDosha.remedies}`);
}🎯 Muhurtha (Auspicious Timing)
// Find auspicious times for important events
const muhurtha = await client.getMuhurtha({
date: '2025-11-01',
location: { latitude: 28.6139, longitude: 77.2090 },
eventType: 'wedding'
});
console.log(`Auspicious times: ${muhurtha.goodTimes}`);
console.log(`Inauspicious times: ${muhurtha.badTimes}`);🔢 Numerology
// 37 numerology calculations
const numerology = await client.getNumerology({
name: 'John Doe',
birthDate: '1990-06-15'
});
console.log(`Life Path Number: ${numerology.lifePath}`);
console.log(`Expression Number: ${numerology.expression}`);
console.log(`Soul Urge Number: ${numerology.soulUrge}`);🌍 Multi-Language Support
Vedika supports 22 languages:
// Ask in Hindi
const response = await client.askQuestion({
question: 'मेरी कुंडली में कौन से योग हैं?',
birthDetails: birthInfo,
language: 'hi'
});
// Ask in Tamil
const response = await client.askQuestion({
question: 'என் ஜாதகத்தில் என்ன யோகங்கள் உள்ளன?',
birthDetails: birthInfo,
language: 'ta'
});Supported languages:
- 🇮🇳 Indian: Hindi, Bengali, Telugu, Tamil, Gujarati, Kannada, Malayalam, Marathi, Punjabi, Odia, Assamese
- 🌍 International: English, Spanish, French, German, Italian, Portuguese, Russian, Japanese, Korean, Chinese, Arabic
🎨 Advanced Features
Voice AI (New in v33)
// Stream voice response (Business/Enterprise plans only)
const audioStream = await client.askVoice({
question: 'What are my career prospects?',
birthDetails: birthInfo,
tier: 'vedika-standard', // $0.072/query: balanced quality + latency (~1s)
// or 'vedika-native' ($0.040): audio-native pipeline, 600+ languages (~800ms)
// or 'vedika-jarvis' ($0.080): ultra-low-latency streaming (<500ms voice-to-voice)
language: 'hi' // 22 languages supported
});
// Rates per tier:
// vedika-standard: 30/min (Business), 100/min (Enterprise)
// vedika-native: 30/min (Business), 100/min (Enterprise)
// vedika-jarvis: 30/min (Business), 100/min (Enterprise)Speed Modes
// Fast mode: 1.5-3 seconds, English only, ~700 word cap
const fastResp = await client.askQuestion({
question: 'Quick career check?',
birthDetails: birthInfo,
speed: 'fast' // Optimized for latency
});
// Standard mode: 12-18 seconds, all languages, full depth (default)
const fullResp = await client.askQuestion({
question: 'Full career analysis?',
birthDetails: birthInfo,
speed: 'standard' // Comprehensive response
});Streaming Responses (Real-Time)
// Stream responses for better UX
for await (const chunk of client.askQuestionStream({
question: 'What are my career prospects?',
birthDetails: birthInfo,
speed: 'standard' // Fast mode not available on streaming
})) {
process.stdout.write(chunk);
}
// Events: 'started', 'progress', 'synthesis', 'data_sources', 'billing_completed', 'completed', 'error'Batch Processing
// Process multiple queries efficiently
const queries = [
{ question: 'Career prospects?', birthDetails: birth1 },
{ question: 'Marriage timing?', birthDetails: birth2 },
{ question: 'Business success?', birthDetails: birth3 }
];
const results = await client.batchProcess(queries);Error Handling
try {
const response = await client.askQuestion({
question: 'What are my career prospects?',
birthDetails: birthInfo
});
console.log(response.answer);
} catch (error) {
if (error.name === 'AuthenticationError') {
console.error('Invalid API key');
} else if (error.name === 'InsufficientCreditsError') {
console.error('Add more credits at https://vedika.io/dashboard.html');
} else if (error.name === 'RateLimitError') {
console.error('Rate limit exceeded, please wait');
} else {
console.error('API error:', error.message);
}
}💰 Pricing
Token-based pricing - pay only for what you use:
| Query Type | Cost | Tokens | |------------|------|--------| | Simple (daily horoscope) | $0.19 | ~500 | | Standard (birth chart) | $0.35 | ~800 | | Complex (comprehensive) | $0.65 | ~1,500 |
Free sandbox: Test with 65 mock endpoints at vedika.io/sandbox — no signup required. Production starts at $12/month.
See full pricing: https://vedika.io/pricing.html
🔧 Configuration
Environment Variables
# .env file
VEDIKA_API_KEY=vk_test_your_api_key_here
VEDIKA_API_URL=https://api.vedika.io # OptionalClient Options
const client = new VedikaClient({
apiKey: 'vk_test_...',
baseUrl: 'https://api.vedika.io', // Optional
timeout: 60000, // Request timeout in milliseconds
maxRetries: 3, // Retry failed requests
cacheEnabled: true, // Enable prompt caching for cost savings
language: 'en' // Default language for responses
});Structured JSON Output
Pass responseFormat: 'json' to receive a parsed section-by-section object alongside the markdown text:
const res = await client.askQuestion({
question: 'What is my marriage timing?',
birthDetails: { /* ... */ },
responseFormat: 'json'
});
// Access structured sections
console.log(res.structuredResponse?.title); // "Marriage Timing"
console.log(res.structuredResponse?.sections); // Array of section objects
// Each section has:
// { heading, level (1-6), paragraphs [], bullets [], numbered [] }
res.structuredResponse?.sections.forEach(section => {
console.log(`## ${section.heading}`);
section.paragraphs.forEach(p => console.log(p));
section.bullets.forEach(b => console.log(`• ${b}`));
section.numbered.forEach((n, i) => console.log(`${i+1}. ${n}`));
});
// Original markdown still available
console.log(res.answer);Perfect for rendering sections independently without parsing markdown.
🧪 Testing
# Install dev dependencies
npm install --save-dev
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test
npm test -- test/chatbot.test.js📝 Examples
Check out the examples/ directory:
basic-chatbot.js- Simple conversational astrology botbirth-chart.js- Complete birth chart generationcompatibility.js- Marriage compatibility analysisdosha-detector.js- Comprehensive dosha analysismuhurtha-finder.js- Find auspicious timesmulti-language.js- Multi-language support demostreaming.js- Real-time streaming responsesexpress-app.js- Express server examplereact-app.jsx- React component example
🐛 Troubleshooting
"Invalid API Key"
Make sure you're using a valid API key from https://vedika.io/dashboard.html
Keys start with:
vk_test_for testingvk_live_for production
"Insufficient Credits"
Add credits to your account: https://vedika.io/dashboard.html
"Request Timeout"
For complex queries, increase timeout:
const client = new VedikaClient({
apiKey: '...',
timeout: 120000 // 2 minutes
});"Rate Limit Exceeded"
You're sending too many requests. Wait a moment or upgrade your plan.
📊 Performance
- Average response time: 2.14 seconds (simple queries)
- Complex queries: 28-36 seconds (deep analysis path)
- Uptime: 99.9% (multi-region failover)
- Accuracy: 97.2% prediction accuracy
🔒 Security
- ✅ API keys encrypted in transit (HTTPS)
- ✅ GDPR compliant
- ✅ No data retention (unless explicitly enabled)
- ✅ Security score: 95/100 (A grade)
📜 License
MIT License - see LICENSE file
🌐 Links
- Website: https://vedika.io
- Documentation: https://vedika.io/docs.html
- API Reference: https://vedika.io/api-reference.html
- Dashboard: https://vedika.io/dashboard.html
- Support: [email protected]
- GitHub: https://github.com/vedika-intelligence
⭐ Support
If you find this SDK helpful, please:
- ⭐ Star this repository
- 🐛 Report issues on GitHub
- 💬 Join our community discussions
- 📧 Contact [email protected] for help
🎯 Why Choose Vedika?
Vedika vs Traditional Astrology APIs
| Feature | Vedika | Others | |---------|--------|--------| | AI Chatbot Queries | ✅ YES (UNIQUE!) | ❌ No | | Birth Charts | ✅ Yes | ✅ Yes | | Dashas | ✅ Yes | ✅ Yes | | Compatibility | ✅ Yes | ✅ Yes | | 300+ Yogas | ✅ Yes | ⚠️ Limited | | Dosha Analysis | ✅ Complete | ⚠️ Basic | | Conversational AI | ✅ Yes | ❌ No | | 30 Languages | ✅ Yes | ❌ English only | | Streaming | ✅ Yes | ❌ No | | Uptime | 99.9% | ~99% | | Security Score | 95/100 (A) | Unknown | | Unique Value | Traditional + AI | Traditional only |
Bottom line: Vedika provides everything other astrology APIs offer, PLUS the only conversational AI chatbot capability in the market.
Built with ❤️ by Vedika Intelligence
The only B2B astrology API with AI-powered chatbot queries.
Get started: https://vedika.io
