How-to Walkthrough
Build a real multi-turn career-guidance feature end to end.
A complete example: a “career guidance” feature that asks a first question, renders the answer with suggested follow-ups, and supports a second turn that remembers the first.
- Collect birth details
Gather date, time, latitude, longitude and IANA timezone from the user. Time is local wall-clock with no offset.
- Make the first call
import os, requests KEY = os.environ["VEDIKA_KEY"] birth = {"datetime": "1990-05-15T10:30:00", "latitude": 28.6139, "longitude": 77.2090, "timezone": "Asia/Kolkata"} r = requests.post("https://api.vedika.io/api/v1/astrology/query", headers={"x-api-key": KEY}, json={"question": "Which career field suits me best?", "birthDetails": birth, "conversationId": "u123-s1"}, timeout=180) d = r.json() print(d["answer"]) print("Follow-ups:", d["followUps"]) print("Cost $", d["metadata"]["cost"]["costUsd"]) - Render answer + follow-ups
Show
answer, and offerfollowUpsas tappable next questions. Optionally showbirthChartfor transparency. - Ask a follow-up on the same thread
r2 = requests.post("https://api.vedika.io/api/v1/astrology/query", headers={"x-api-key": KEY}, json={"question": "What is the best time to switch jobs?", "birthDetails": birth, "conversationId": "u123-s1"}, timeout=180) print(r2.json()["answer"]) # remembers turn 1 - Go faster for chat
For an interactive UI, add
"speed": "fast"(Vedika Swift, Business+) or stream tokens with the stream endpoint.
#Ship checklist
- Key stays server-side; read from the environment.
- Handle
400/401/402/429/503— see Error Codes. - Retry with backoff and an
Idempotency-Keyto avoid double-billing. - Show
metadata.cost.costUsdif you pass usage costs to your own users. - Reuse
conversationIdand identicalbirthDetailsacross turns.