If you’re building astrology features in Python, you have two paths: bundle an
ephemeris library and do the math locally, or call an API that already does it.
This post takes the API route with AstroWay — pip install, a
first natal chart, then transits and synastry — and shows where each approach
makes sense.
Install
Section titled “Install”pip install astroway# or: uv add astroway / poetry add astrowayGrab a key at the dashboard — 10,000 credits/month free, no card. A full natal chart costs 20 credits, so the free tier covers roughly 500 charts a month.
1. A natal chart
Section titled “1. A natal chart”The SDK exposes typed namespaces generated from the OpenAPI spec. chart.compute
takes a BirthData model (or a plain dict) and returns the unwrapped result —
no { ok, data } envelope to peel:
from astroway import Astroway, BirthData
aw = Astroway(api_key="aw_live_...")
chart = aw.chart.compute(BirthData( date="1990-07-14", time="14:30:00", timezone_offset=3, latitude=50.45, longitude=30.52,))
for planet in chart.planets: print(f"{planet.name:10} {planet.longitude:.2f}° in {planet.sign}")The API does not geocode — pass the latitude/longitude and the UTC offset
for the birth moment yourself (a one-line lookup with geopy + timezonefinder
if you only have a city name).
2. Transits for “what’s happening now”
Section titled “2. Transits for “what’s happening now””Transit-based features (daily insights, “Saturn is squaring your Sun”) need a
second date. transits.compute takes the birth data plus a target_date:
from astroway import TransitsRequest
transits = aw.transits.compute(TransitsRequest( date="1990-07-14", time="14:30:00", timezone_offset=3, latitude=50.45, longitude=30.52, target_date="2027-01-01",))
for hit in transits.aspects: print(f"{hit.transiting} {hit.aspect} natal {hit.natal} (orb {hit.orb:.1f}°)")This is the real difference between a calculation API and a “horoscope text” API: you get the actual aspects, not a paragraph generated by an LLM.
3. Synastry for relationship features
Section titled “3. Synastry for relationship features”synastry.compute takes two charts and returns the inter-aspect grid plus a
compatibility score:
from astroway import SynastryRequest
result = aw.synastry.compute(SynastryRequest( chart1=BirthData(date="1990-07-14", time="14:30:00", timezone_offset=3, latitude=50.45, longitude=30.52), chart2=BirthData(date="1992-03-22", time="09:15:00", timezone_offset=2, latitude=48.85, longitude=2.35),))
print(f"Compatibility: {result.score}/100")Async, retries, errors
Section titled “Async, retries, errors”The async client has the same surface. Retries on 429/5xx with exponential backoff are built in, and errors are a typed hierarchy:
import asynciofrom astroway import AsyncAstrowayfrom astroway import RateLimitError, BadRequestError
async def main(): async with AsyncAstroway(api_key="aw_live_...") as aw: try: chart = await aw.chart.compute({ "date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3, "latitude": 50.45, "longitude": 30.52, }) except RateLimitError: ... # back off and retry later except BadRequestError as e: print(e) # which field failed validation
asyncio.run(main())(Note: the BirthData model uses timezone_offset; a raw dict uses the
JSON field name timezoneOffset. Both work.)
API vs pyswisseph vs kerykeion
Section titled “API vs pyswisseph vs kerykeion”- pyswisseph — Python bindings for the Swiss Ephemeris C library. Maximum control, but you compile a C extension, ship the ephemeris data files, and implement house systems, aspects and chart logic yourself.
- kerykeion — a higher-level library on top of pyswisseph. Less boilerplate, but still a local dependency you install, version and deploy.
- AstroWay — the same Swiss Ephemeris engine (compiled to WebAssembly server side), reached over HTTP. Nothing to compile or ship; you trade a network round-trip for zero install and 722 endpoints beyond the natal chart (synastry, transits, Vedic, Human Design, AI interpretations).
Rule of thumb: a CLI tool or a notebook that runs offline → a local library. A web app, a serverless function, or anything where you don’t want to manage ephemeris files and house-system code → the API.
Where to go next
Section titled “Where to go next”- Python SDK reference — full namespace list
- Pricing — credit costs per endpoint
- Birth Chart API — the natal endpoint in depth
- Best astrology APIs in 2026 — how the options compare
Αυτή η ίδια Swiss Ephemeris που υπάρχει στο Solar Fire — σε 4 γραμμές κώδικα.
Δωρεάν κλειδί χωρίς κάρτα. 5.000 αιτήματα ανά μήνα μέχρι την πρώτη πληρωμή.