API Features · Python

JSON Mode

Get structured JSON responses from XALEN models. Perfect for programmatic consumption of astrology data and AI outputs.

1. Install

pip install xalen

2. Code

response = client.chat.completions.create(
    model=#A6E3A1;">"vedika-standard",
    messages=[{#A6E3A1;">"role": "user", "content": "Return the planetary positions for 1990-03-15 14:30 Mumbai as JSON"}],
    response_format={#A6E3A1;">"type": "json_object"}
)

#89B4FA;">import json
data = json.loads(response.choices[0].message.content)
#89B4FA;">print(json.dumps(data, indent=2))

Related Tutorials

Streaming Responses API Features · Python Function Calling API Features · Python Batch Processing (50% Off) API Features · Python Build RAG with Embeddings API Features · Python Python Quickstart Getting Started · Python JavaScript Quickstart Getting Started · JavaScript

200+ AI models. One API. Start building in 5 minutes.

Get API Key

Last updated: 2026-05-21