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]"
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
See the complete developer documentation for every method, request field, quota rule, and response example.
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=, and timeline_timeout= when constructing the
client. A timeout may still consume quota if the gateway already accepted the work.
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:
ValidationErrorHTTPErrorRequestTimeoutErrorClientBusyErrorTransportErrorResponseError
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
- Documentation: https://cosmicephemeris.com/docs-developer-platform.html
- Support: support@cosmicephemeris.com
- License: ISC
Metadata
Release files for cosmicephemeris-client 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cosmicephemeris_client-0.3.1.tar.gz | 71.7 kB | With provenance | Details for cosmicephemeris_client-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cosmicephemeris_client-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for cosmicephemeris_client-0.3.1-py3-none-any.whl |
Total release size: 117.4 kB
Release files / cosmicephemeris_client-0.3.1.tar.gz
| Download URL | cosmicephemeris_client-0.3.1.tar.gz |
|---|---|
| Size | 71.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bed6447745823224ebc5a7ddb4de2397e0aa94d95d7e4b57ab78d2aafed5f318
|
|
BLAKE2b-256 checksum How to use checksums |
9564d91d2a6e6e7122995250aeb050a8cf2c343839c14e609d296ffd3e705493
|
| 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 10, 2026.
Transparency logRelease files / cosmicephemeris_client-0.3.1-py3-none-any.whl
| Download URL | cosmicephemeris_client-0.3.1-py3-none-any.whl |
|---|---|
| Size | 45.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88d5f272f8ef31c41584ca52836659f732db585ea1722621eda9f9124fa9ae21
|
|
BLAKE2b-256 checksum How to use checksums |
b464a32571d6bc889347e2eda5c1e7021b8e38c6f2658accdec3f56fb4090c2a
|
| 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 10, 2026.
Transparency logSecurity for cosmicephemeris-client 0.3.1
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.
Attestation for cosmicephemeris_client-0.3.1.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 10, 2026.
Transparency logA 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.