AstroWay/api v2.180.1 · ja
すべてのシステムが正常です

アストロロジーAPIのクイックスタート: TypeScriptとPythonで5分間

SDKのインストール、APIキーの取得、最初のナタールチャートのリクエスト。5分で動作するJSONを手に入れる(TypeScriptとPython)

🕓 記録: 2026-04-14、更新: 2026-05-09。 TS / Python / PHP SDK は現在 public registries にあります - @astroway/sdk (npm), astroway (PyPI), astroway/sdk (Packagist)。 詳細は changelog

コードからネイタルチャートを計算したいんだね。最短ルートはこれだよ - 5分でゼロから動く JSON が手に入る。

ステップ 1: APIキーを取得(30秒)

Section titled “ステップ 1: APIキーを取得(30秒)”

api.astroway.info/dashboard/sign-up にサインアップしよう。無料プラン: 10 000 クレジット / 月。カード不要。

dashboard で「Create key」→「Production」をクリックしてコピー。キーは aw_live_aB3xY7pQ9rN2mK4jH8vC5tL6wZ1fD0eR のような形式です。

ヒント: プレフィックス aw_test_ のサンドボックスキーもあるよ - クレジットは消費されない。開発時に使ってね。

Terminal window
npm install @astroway/sdk
Terminal window
pip install astroway

両方の SDK はすべての 758 エンドポイントを型付けされたリクエストとレスポンスでカバーしている。

ステップ 3: 最初のネイタルチャート

Section titled “ステップ 3: 最初のネイタルチャート”
import { Astroway } from '@astroway/sdk';
const aw = new Astroway({
apiKey: process.env.ASTROWAY_API_KEY!,
});
const chart = await aw.chart.compute({
date: '1990-07-14',
time: '14:30:00',
timezoneOffset: 3, // UTC+3, літо в Києві
latitude: 50.4501,
longitude: 30.5234,
houseSystem: 'P', // Placidus
});
const SIGNS = ['Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo',
'Libra', 'Scorpio', 'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces'];
const sun = chart.planets.find((p) => p.name === 'Sun')!;
console.log(`Sun: ${SIGNS[Math.floor(sun.longitude / 30)]} at ${sun.longitude.toFixed(2)}°`);
console.log(`ASC: ${chart.houses.ascendant.toFixed(2)}°`);
console.log(`Aspects: ${chart.aspects.length}`);

実行:

Terminal window
ASTROWAY_API_KEY=aw_live_... npx tsx chart.ts

ファイルはトップレベル await を使用しているので、package.json"type": "module" を設定しておく必要がある。そうしないと tsx が Top-level await is currently not supported with the "cjs" output format で失敗する。

from astroway import Astroway, BirthData
aw = Astroway(api_key="aw_live_your_key_here")
chart = aw.chart.compute(BirthData(
date="1990-07-14",
time="14:30:00",
timezone_offset=3,
latitude=50.4501,
longitude=30.5234,
house_system="P",
))
SIGNS = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo",
"Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"]
sun = next(p for p in chart["planets"] if p["name"] == "Sun")
print(f"Sun: {SIGNS[int(sun['longitude'] // 30)]} at {sun['longitude']:.2f}°")
print(f"ASC: {chart['houses']['ascendant']:.2f}°")
print(f"Aspects: {len(chart['aspects'])}")

実行:

Terminal window
ASTROWAY_API_KEY=aw_live_... python3 chart.py

JSON オブジェクトが返され、4つの主要セクションが含まれる:

13 個のオブジェクトからなる配列。name には Swiss Ephemeris の天体名が入る: Sun, Moon, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto, true Node(北交点), mean Apogee(リリス), Chiron

{
"id": 0,
"name": "Sun",
"longitude": 354.702, // еклiптична довгота у градусах
"latitude": -0.00016,
"distance": 0.9945, // в астрономічних одиницях
"speedLong": 0.9971, // градусів на день (від'ємне = ретроград)
"speedLat": 0.00003,
"speedDist": 0.00019,
"isRetrograde": false,
"declination": -1.4159,
"rightAscension": 355.437
}

サインとハウスはここには含まれないので、サインは Math.floor(longitude / 30)、ハウスは houses のカスピッドで計算してね。

ハウスのカスピッド(12 個)と、asc と MC が含まれる:

{
"system": "P",
"cusps": [118.18, 138.27, ...], // 12 значень
"ascendant": 118.18,
"mc": 12.708,
"armc": 11.69,
"vertex": 253.97,
"equatorialAsc": 100.75,
"coAscWK": 81.13,
"coAscMunkasey": 123.7,
"polarAsc": 261.13
}

惑星間のアスペクトの配列:

{
"planet1": "Sun",
"planet2": "Mercury",
"planet1Id": 0,
"planet2Id": 2,
"type": { // об'єкт, не рядок
"name": "Conjunction",
"i18nKey": "aspect_conjunction",
"angle": 0,
"orb": 12,
"symbol": "",
"isMajor": true,
"color": "#660480"
},
"exactAngle": 3.365,
"orb": 3.365, // відхилення від точного у градусах
"isApplying": true
}

"diurnal"(出生時に太陽が地平線上)または "nocturnal"(地平線下)。古典占星術で使用される。

他に試すこと:

シナストリー: 2 人の相性:

const synastry = await client.synastry({
chart1: { date: '1990-07-14', time: '14:30:00', timezoneOffset: 3, latitude: 50.45, longitude: 30.52 },
chart2: { date: '1992-03-22', time: '09:15:00', timezoneOffset: 2, latitude: 48.85, longitude: 2.35 },
});
console.log(`Compatibility score: ${synastry.compatibility.score}/100`);

現在のトランジット(ネイタルチャート向け):

const transits = await client.transits({
// дані народження
date: '1990-07-14', time: '14:30:00', timezoneOffset: 3,
latitude: 50.4501, longitude: 30.5234,
// дата транзиту
transitDate: '2026-04-14',
});

実際のトランジットからのデイリーホロスコープ:

const horoscope = await client.horoscopeDaily({
date: '1990-07-14', time: '14:30:00', timezoneOffset: 3,
latitude: 50.4501, longitude: 30.5234,
});
console.log(horoscope.text);

完全な Human Design マップ:

const hd = await client.humanDesign({
date: '1990-07-14', time: '14:30:00', timezoneOffset: 3,
latitude: 50.4501, longitude: 30.5234,
});
console.log(`${hd.type} - ${hd.strategy} - Profile ${hd.profile}`);
  • ネイタルチャート (/chart): 20 クレジット
  • シナストリー: 50 クレジット
  • トランジット: 50 クレジット
  • デイリーホロスコープ: 20 クレジット
  • Human Design: 50 クレジット

無料プラン: 10 000 クレジット / 月 = 500 件のネイタルチャート、または 200 件のシナストリー、または混合利用。

各レスポンスにはクレジット情報がヘッダーに含まれる:

X-Credits-Used: 20
X-Credits-Remaining: 4980
X-Credits-Reset: 2026-05-01T00:00:00Z

クレジットがなくなると 402 Payment Required が返る。レートリミットに達すると(Free: 10 リクエスト / 分)429 Too Many Requests が返り、ヘッダーに Retry-After が含まれる。

SDK は型付けされたエラーをスローするので、キャッチできる:

import { QuotaExceededError, RateLimitError } from '@astroway/sdk';
try {
const chart = await aw.chart.compute(birth);
} catch (err) {
if (err instanceof QuotaExceededError) {
console.log('Upgrade plan or wait for reset');
} else if (err instanceof RateLimitError) {
console.log(`Retry in ${err.retryAfterSeconds ?? 60} seconds`);
} else {
throw err;
}
}

具体的なエラーから一般的なエラーへ順にキャッチすべきだ。すべては ApiError を継承しているので、最初にそれをチェックすれば他のエラーを捕捉できる。

これで君は以下を手に入れた:

  • 動作する API キー
  • インストール済み SDK
  • 最初のネイタルチャート
  • シナストリー、トランジット、ホロスコープを追加するための十分なサンプル

さらに読む:

MakSeong · AstroWay

AstroWay API を作っている: Swiss Ephemeris を純粋な REST にラップし、実際に重要な退屈な詳細を書いています。

// この上に構築

Solar Fireと同じSwiss Ephemeris - 4行のコードで。

無料のキー(カード不要)。最初の支払いまでに月5,000回の呼び出し。

より多くのブログ

Industry 2026-06-05

Free Astrology API: Which One Has the Best Free Tier in 2026?

A side-by-side of free tiers across the major astrology APIs - credits, request caps, card requirements - and how much you can actually build for free.

Engineering 2026-06-05

Horoscope API Tutorial: Build a Daily Horoscope Feature

Add daily, weekly and monthly horoscopes to your app via API - sign-based text vs transit-based personalization - with TypeScript and Python code.

Engineering 2026-06-05

Natal Chart API in PHP: SDK + Laravel Example

Compute a natal chart in PHP with the AstroWay SDK - plain PHP and a Laravel facade - without compiling a Swiss Ephemeris extension.