AstroWay/api v2.95.1 · ko
모든 시스템 정상 작동 중

Natal Chart API in Python: 3 Examples with the AstroWay SDK

How to compute a natal chart in Python via API — install, first request, transits and synastry — with working code and how it compares to pyswisseph and kerykeion.

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 AstroWaypip install, a first natal chart, then transits and synastry — and shows where each approach makes sense.

Terminal window
pip install astroway
# or: uv add astroway / poetry add astroway

Grab 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.

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.

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")

The async client has the same surface. Retries on 429/5xx with exponential backoff are built in, and errors are a typed hierarchy:

import asyncio
from astroway import AsyncAstroway
from 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.)

  • 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.

AstroWay team

AstroWay API 엔지니어링 팀. Swiss Ephemeris를 깔끔한 REST로 감싸고, 사실상 중요한 지루한 세부 사항들을 다룹니다.

// 이걸로 빌드해

Solar Fire에 사용된 것과 동일한 Swiss Ephemeris — 단 4줄의 코드로.

카드 없이 무료 키. 첫 결제 전까지 월 5,000 API 호출.

더 많은 블로그 글 모든 글 보기 →

Ephemeris 2026-06-05

How Accurate Is the Swiss Ephemeris? Verified Benchmarks

Swiss Ephemeris accuracy in numbers — planetary positions under 0.1 arcsecond, exact house cusps, eclipses within a minute — and how AstroWay verifies it.

Ephemeris 2026-06-05

Swiss Ephemeris: REST API vs pyswisseph (When to Use Which)

pyswisseph vs a REST API for Swiss Ephemeris calculations — C dependencies, data files, licensing and deployment compared, with a decision guide.

Engineering 2026-05-21

베다 아스트로로지 API: 파라샤리에서 라尔 키탑까지 354개의 엔드포인트

AstroWay는 현재 상업용 API 중 가장 완벽한 베다 아스트로로지 커버리지를 제공합니다. 10개의 다샤 시스템, 16개의 바르가, 판창, 라尔 키탑 + KP + 자이미니. 어떻게 작동하는지 및 언제 어떤 기술을 선택해야 하는지