Official Python SDK for the Astrolinkers API — natal charts, talent profiles, Vedic calculations and engine-grounded LLM interpretations.
Project description
Astrolinkers Python SDK
Official Python client for the Astrolinkers API — natal charts, talent profiles, Vedic calculations, and engine-grounded LLM interpretations.
- Sync + async clients (
Astrolinkers/AsyncAstrolinkers). - Typed everything — Pydantic v2 models,
py.typedmarker, mypy strict. - Streaming of LLM interpretations as a typed iterator of events.
- Retry-aware — honours
Retry-After, exponential backoff with jitter on transient failures. - Multilingual — English plus 8 Indian languages + Spanish out of the box.
Status: alpha (
0.2.0). Public API may shift between minor releases until1.0. Pin the minor version when integrating.
Resource map
| Resource | Wraps | Notes |
|---|---|---|
client.charts |
/v1/charts |
Compute / fetch natal charts. |
client.llm |
/v1/llm/... (sync + stream) |
LLM interpretations, persistence, usage summary. |
client.interpretations |
/v1/interpretations |
Template-driven interpretations + statements. |
client.compatibility |
/v1/compatibility |
Synastry + ashtakoota between two charts. |
client.feedback |
/v1/feedback |
Feedback on statements + rolling template accuracy. |
client.profiles |
/v1/charts/{id}/profile/talent |
Talent / hiring skill profile. |
client.reports |
/v1/reports |
Async PDF / HTML report generation. |
client.vedic |
58 × /v1/vedic/... |
Full Vedic engine — divisional, dasha, shadbala, panchanga, predictive, KP, muhurta. |
client.api_keys |
/v1/api-keys |
Issue / list / revoke your own tokens. |
client.plans |
/v1/plans, /v1/tenant/plan |
Catalogue + tenant plan management. |
client.usage |
/v1/api-keys/{id}/usage, /v1/tenant/usage |
Hourly API-call buckets. |
client.health |
/healthz, /readyz, /version |
Liveness / readiness / build info. |
client.request(...) / client.stream(...) |
any | Escape hatch for endpoints not yet wrapped. |
Install
pip install astrolinkers-sdk
# or with uv
uv add astrolinkers-sdk
Requires Python 3.12+.
Quickstart
from datetime import datetime, UTC
from astrolinkers import Astrolinkers, InterpretationTier, Language
client = Astrolinkers(api_key="alk_live_…")
# 1. Compute a natal chart.
chart = client.charts.create(
moment=datetime(1990, 4, 15, 2, 0, tzinfo=UTC),
latitude=28.6139, longitude=77.2090,
timezone="Asia/Kolkata",
location_name="New Delhi, India",
)
# 2. Ask the LLM for a per-life-area interpretation.
career = client.llm.theme(
chart_id=chart.id,
theme="career",
language=Language.EN,
tier=InterpretationTier.STANDARD,
)
print(career.content)
# 3. Full-chart reading at premium depth.
reading = client.llm.chart_reading(
chart_id=chart.id,
language=Language.HI, # Hindi (Devanagari script)
tier=InterpretationTier.PREMIUM,
)
print(reading.cost_usd, reading.cached)
Streaming
Every LLM endpoint has a *_stream sibling that yields typed events as the
model produces tokens. The first event is MetaEvent carrying the engine
context — render it immediately so users see grounded numbers before any
LLM text arrives.
from astrolinkers import Astrolinkers, MetaEvent, DeltaEvent, DoneEvent
client = Astrolinkers(api_key="alk_live_…")
for event in client.llm.chart_reading_stream(chart_id=chart.id, tier="standard"):
match event:
case MetaEvent():
ui.render_engine_blocks(event.engine_context)
case DeltaEvent():
ui.append_text(event.content)
case DoneEvent():
ui.show_cost(event.cost_usd, cached=event.cached)
Async usage is identical — async for event in client.llm.chart_reading_stream(...).
Re-reading past LLM interpretations
Every successful LLM call is persisted server-side. List and read
past LLM interpretations without re-billing — the persistence methods
live on client.llm:
page = client.llm.list_stored(chart_id=chart.id, limit=20)
for row in page.items:
print(row.id, row.interpretation_type, row.cost_usd, row.created_at)
# Fetch one back later.
row = client.llm.retrieve_stored(page.items[0].id)
print(row.content)
(Template-driven interpretations have their own resource at
client.interpretations.create / retrieve.)
Usage analytics
from datetime import datetime, UTC, timedelta
from astrolinkers import UsageGroupBy
today = datetime.now(UTC)
summary = client.llm.usage_summary(
from_=today - timedelta(days=30),
to=today,
group_by=UsageGroupBy.TIER,
)
print(f"30-day LLM spend: ${summary.total.cost_usd:.4f}")
for bucket in summary.breakdown:
print(f" {bucket.label}: {bucket.call_count} calls, ${bucket.cost_usd:.4f}")
Vedic engine
from astrolinkers import Varga, TheoArea, HouseSignificator
# Divisional chart D9 (navamsa).
d9 = client.vedic.divisional(chart.id, Varga.D9)
# Composite per-planet strength.
strengths = client.vedic.composite_strength(chart.id)
# Date-bound career probability folding in current transit modifier.
prob = client.vedic.materialization_at(
chart.id, TheoArea.CAREER, at=datetime.now(UTC),
)
# Full theme probability decomposition.
career = client.vedic.probability(chart.id, HouseSignificator.CAREER)
Every Vedic method returns a dict[str, Any] — the engine output is
deeply nested structured JSON that is more naturally indexed than
matched against a typed model.
Escape hatch
For any endpoint the SDK does not yet wrap, the typed client still gives you authenticated requests with the same retry / error-mapping behaviour:
data = client.request("GET", "/v1/some-new-endpoint", params={"x": 1})
with client.stream("POST", "/v1/some-stream") as resp:
for line in resp.iter_lines():
...
Error handling
from astrolinkers import (
Astrolinkers,
RateLimitedError, AuthenticationError, BudgetExceededError,
NotFoundError, ServerError,
)
try:
reading = client.llm.chart_reading(chart_id="bogus", tier="premium")
except NotFoundError:
...
except RateLimitedError as e:
print(f"Slow down for {e.retry_after_seconds:.0f}s")
except BudgetExceededError as e:
print(f"Budget hit: ${e.spent_usd:.2f} of ${e.cap_usd:.2f}")
except AuthenticationError:
...
except ServerError:
... # The SDK already retried; this is a real outage.
Async usage
import asyncio
from astrolinkers import AsyncAstrolinkers
async def main():
async with AsyncAstrolinkers(api_key="alk_live_…") as client:
chart = await client.charts.create(...)
reading = await client.llm.chart_reading(chart_id=chart.id)
print(reading.content)
asyncio.run(main())
Configuration
| Argument | Default | Notes |
|---|---|---|
api_key |
— | Required. Bearer token issued by Astrolinkers. |
base_url |
https://api.astrolinkers.com |
Override for staging / self-hosted. |
timeout |
60s | Connect / write timeout. |
read_timeout |
300s | Long for premium streams. None disables. |
max_retries |
2 | Transient 5xx / connection errors. 429 honours Retry-After. |
user_agent_suffix |
— | Appended to User-Agent for server-side correlation. |
Versioning
Semantic versioning. Until 1.0 breaking changes may land on minors; pin
your minor (astrolinkers-sdk~=0.2) and bump deliberately.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astrolinkers_sdk-0.2.1.tar.gz.
File metadata
- Download URL: astrolinkers_sdk-0.2.1.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d219e22884ac0c4cb0a35eba9499b90033dd0d1c6e6bea19c2838cff48b1d8d8
|
|
| MD5 |
e34020e36a41a15ecce2b1ec076a2140
|
|
| BLAKE2b-256 |
97128f279e9ac7cd5bc037e583c79a38eddc42836de3aa9c350abfa4ef7a40dc
|
Provenance
The following attestation bundles were made for astrolinkers_sdk-0.2.1.tar.gz:
Publisher:
release.yml on fedorello/astrolinkers-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astrolinkers_sdk-0.2.1.tar.gz -
Subject digest:
d219e22884ac0c4cb0a35eba9499b90033dd0d1c6e6bea19c2838cff48b1d8d8 - Sigstore transparency entry: 1571992388
- Sigstore integration time:
-
Permalink:
fedorello/astrolinkers-sdk-python@b1850c5a5a77c36e22e50282e6dd5fa0047757fa -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/fedorello
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b1850c5a5a77c36e22e50282e6dd5fa0047757fa -
Trigger Event:
push
-
Statement type:
File details
Details for the file astrolinkers_sdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: astrolinkers_sdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99b9b7d039d02bda428afca8107ae018dd870989c501d4540b3b4fec4db04329
|
|
| MD5 |
9712f2ee08483a33ce77002784646f2b
|
|
| BLAKE2b-256 |
001742f9009567aad857dc30081ed56644d8a0de3c0ccaf1380b0dc767c0a772
|
Provenance
The following attestation bundles were made for astrolinkers_sdk-0.2.1-py3-none-any.whl:
Publisher:
release.yml on fedorello/astrolinkers-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astrolinkers_sdk-0.2.1-py3-none-any.whl -
Subject digest:
99b9b7d039d02bda428afca8107ae018dd870989c501d4540b3b4fec4db04329 - Sigstore transparency entry: 1571992408
- Sigstore integration time:
-
Permalink:
fedorello/astrolinkers-sdk-python@b1850c5a5a77c36e22e50282e6dd5fa0047757fa -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/fedorello
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b1850c5a5a77c36e22e50282e6dd5fa0047757fa -
Trigger Event:
push
-
Statement type: