Streaming Responses

Stream the AI Query answer token by token for chat and typeahead UIs.

#The streaming endpoint

GET https://api.vedika.io/api/v1/astrology/query/stream streams the answer token-by-token, server-sent style, instead of waiting for the full response. Use it anywhere people watch an answer arrive live — chat interfaces, typeahead, voice UIs.

FieldNotes
questionRequired. The natural-language question to answer.
birthDetailsBirth chart context — datetime, latitude, longitude, timezone — used to ground the answer.
languageResponse language.
speedDelivery tier: eco, standard or fast.
responseFormatResponse shape: text (default), markdown or json.

#Example

Open the stream and read tokens as they arrive:

curl -N -G "https://api.vedika.io/api/v1/astrology/query/stream" \
  -H "x-api-key: $VEDIKA_KEY" \
  --data-urlencode "question=Which career field suits me best?" \
  --data-urlencode 'birthDetails={"datetime":"1990-05-15T10:30:00","latitude":28.6139,"longitude":77.2090,"timezone":"Asia/Kolkata"}' \
  --data-urlencode "speed=fast"
const params = new URLSearchParams({
  question: "Which career field suits me best?",
  birthDetails: JSON.stringify({
    datetime: "1990-05-15T10:30:00",
    latitude: 28.6139, longitude: 77.2090,
    timezone: "Asia/Kolkata",
  }),
  speed: "fast",
});

const res = await fetch(
  `https://api.vedika.io/api/v1/astrology/query/stream?${params}`,
  { headers: { "x-api-key": process.env.VEDIKA_KEY } },
);

const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  process.stdout.write(decoder.decode(value, { stream: true }));
}

#Tier availability

Streaming is available on all four delivery tiers All plans — Eco, Standard, Swift and Pro Ultra. On Vedika Swift (speed:"fast", ~1,800 tok/s) tokens arrive fast enough to feel near-instant.

Tip
Billing settles once, at the end of the stream — the same as a non-streaming call. A malformed request still returns 400 before any tokens are sent, so bad input never starts, or gets charged for, a stream.