The @askvedicguru/sdk package wraps the REST API in a typed, promise-based client. It works in Node.js 18+, Deno, Bun, and any environment that supports the Fetch API.
Install
bash
npm install @askvedicguru/sdk
# or
bun add @askvedicguru/sdk
# or
yarn add @askvedicguru/sdkQuick start
ts
import { AskVedicGuru } from '@askvedicguru/sdk'
const guru = new AskVedicGuru({
apiKey: process.env.ASKVEDICGURU_API_KEY!,
})
const profiles = await guru.profiles.list()
const chart = await guru.chart.full(profiles[0].id)Configuration
ts
const guru = new AskVedicGuru({
apiKey: 'avg_...', // required
apiUrl: 'https://...', // optional: custom base URL
timeout: 30_000, // optional: request timeout in ms (default: 30000)
maxRetries: 2, // optional: retries on 5xx / timeout (default: 2)
})Error handling
The SDK throws typed errors you can import directly:
ts
import {
AskVedicGuru,
AuthenticationError,
InsufficientCreditsError,
PlanRequiredError,
RateLimitError,
NotFoundError,
ValidationError,
VedicError,
} from '@askvedicguru/sdk'
try {
const chart = await guru.chart.full(profileId)
} catch (err) {
if (err instanceof InsufficientCreditsError) {
console.error('Out of credits — top up at the dashboard')
} else if (err instanceof RateLimitError) {
console.error(`Rate limited. Retry after ${err.retryAfter}s`)
} else if (err instanceof PlanRequiredError) {
console.error('Upgrade your plan to use this endpoint')
} else if (err instanceof VedicError) {
console.error(`API error ${err.code}: ${err.message}`)
}
}TypeScript
The SDK is written in TypeScript and ships with full type definitions — no @types/* package needed.
ts
import type { Profile, RashifalData, BirthChartData } from '@askvedicguru/sdk'