Skip to main content

Cosmic Ephemeris Python SDK

The official synchronous Python client for the Cosmic Ephemeris calculation API.

  • 78 calculation methods
  • Python 3.10 or newer
  • Typed inputs and route-specific response envelopes
  • No required runtime dependencies
  • Bounded transport concurrency, responses, and deadlines
  • Sanitized errors and no automatic retries

Install

python -m pip install cosmicephemeris-client

Optional signed-receipt verification uses cryptography:

python -m pip install "cosmicephemeris-client[receipts]>=0.3.3"

Compatibility

Version 0.3.3 accepts the current status returned by all 78 calculation contracts. Upgrade before deploying the matching server contract; 0.3.2 strictly expects the former status value on promoted routes and can reject otherwise valid responses.

Quick start

from cosmicephemeris_client import (
    CosmicEphemerisClient,
    HTTPError,
    RequestTimeoutError,
)

client = CosmicEphemerisClient()  # Reads COSMICEPHEMERIS_KEY.

try:
    result = client.birth_chart({
        "date": "1990-01-01",
        "time": "12:00",
        "timezone": "America/New_York",
        "lat": 40.7128,
        "lon": -74.006,
    })
    print(result["chart"]["planets"]["Sun"])
except HTTPError as error:
    print(error.status, error.retry_after)
except RequestTimeoutError:
    print("The deadline expired; admitted work may still consume quota.")

You may pass api_key= explicitly. An explicit key takes precedence over COSMICEPHEMERIS_KEY.

API keys are server credentials. Never put them in browser code, mobile applications, URLs, public environment variables, analytics, notebooks intended for sharing, or source control.

Methods and typing

Methods use Python snake case and map directly to the documented REST operations. They return the complete response dictionary without changing its envelope.

The package is marked with py.typed. Every public method has a documented input TypedDict and a route-specific response type derived from the maintained OpenAPI contract. Selected complex responses have additional hand-maintained nested types.

Common groups include:

  • Natal charts, houses, aspects, transits, synastry, composite, and Davison charts
  • Vedic Vargas, Vimshottari, Panchang, Ashtakoota, and Ashtakavarga
  • Moon phases, planetary events, aspect windows, eclipses, and event calendars
  • SVG, PNG, reports, and structured export formats
  • Place search, timezone resolution, relocation, and astrocartography
  • Convention, uncertainty, robustness, and electional audit operations

Use the full calculation reference, copy-paste API examples, and OpenAPI document for every operation's exact request and response contract. The developer platform guide owns shared authentication, quota, job, and integration rules.

Transport and deadlines

The client:

  • Validates the API key and documented input boundaries before transport.
  • Uses verified HTTPS and sends credentials only to the configured origin.
  • Ignores proxy environment variables, cookies, and redirects.
  • Allows HTTP only through explicit loopback-only test configuration.
  • Bounds request size, response size, and outstanding transport workers.
  • Rejects compressed, malformed, truncated, duplicate-key, and non-finite JSON.
  • Does not retry automatically.

Default deadlines vary by operation. They can be bounded with timeout=, planetary_events_timeout=, aspect_windows_timeout=, and timeline_timeout= when constructing the client. A timeout may still consume quota if the gateway already accepted the work.

Methods outside the longer route groups use a 20-second default deadline. Version 0.3.3 gives event_calendar the 35-second planetary-event deadline for its 30-second engine budget. planetary_events_timeout= configures that route group. The client deadline is a safety bound, not a response-time promise.

Errors

Errors expose only safe structured information. They do not include API keys, request payloads, response bodies, raw headers, URLs, or underlying transport exception details.

The primary classes are:

  • ValidationError
  • HTTPError
  • RequestTimeoutError
  • ClientBusyError
  • TransportError
  • ResponseError

Signed calculation receipts

from cosmicephemeris_client import verify_calculation_receipt

valid = verify_calculation_receipt(response, public_jwk)

Receipt verification requires the optional receipts dependency. It checks the Ed25519 signature and canonical hashes. It proves response integrity and service provenance; it does not independently validate the meaning or correctness of a calculation.

Local verification

From clients/python:

python scripts/generate_response_types.py --check
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python -m unittest discover -s tests -v
python -m build

Tests use synthetic credentials and local HTTP/TLS servers. They do not call the production API unless an example is deliberately run with a real key.

Support and license

Metadata

Release files for cosmicephemeris-client 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmicephemeris-client 0.3.3
File Size Uploaded Provenance Actions
cosmicephemeris_client-0.3.3.tar.gz 73.7 kB With provenance Details for cosmicephemeris_client-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cosmicephemeris-client 0.3.3
File Interpreter ABI Platform Actions
cosmicephemeris_client-0.3.3-py3-none-any.whl Python 3 none any Details for cosmicephemeris_client-0.3.3-py3-none-any.whl

Total release size: 119.8 kB

Release files / cosmicephemeris_client-0.3.3.tar.gz

Download URL cosmicephemeris_client-0.3.3.tar.gz
Size 73.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab66c5a96d527901afcb3a5ac838068f99e453cb0e5aee1550827182a02997a7
BLAKE2b-256 checksum
How to use checksums
2125fea639dc4a90549bcaac1c21f88b03891f7461d308c88ae4831224254355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / cosmicephemeris_client-0.3.3-py3-none-any.whl

Download URL cosmicephemeris_client-0.3.3-py3-none-any.whl
Size 46.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d23d9689c7e52207840fbf824af02b2319c8e81460f1f922f1ee1abd920fc409
BLAKE2b-256 checksum
How to use checksums
af9bc1f9a5beb9dc542b803a1261691013349a46819343669431a450f06c7aa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for cosmicephemeris-client 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cosmicephemeris_client-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page