> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alterscope.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Sync and async Python client for the Alterscope API, generated from the canonical OpenAPI spec.

The Python SDK is published as [`alterscope`](https://pypi.org/project/alterscope/) on PyPI. It is generated from the canonical OpenAPI spec, so the API reference and the client stay in lockstep.

## Install

```bash theme={null}
pip install alterscope

# with async support
pip install "alterscope[async]"
```

Python 3.10+ is supported.

## Sync client

```python theme={null}
from alterscope import AlterscopeClient, freshness_status_of

client = AlterscopeClient(api_key="sk_live_...")

oracle = client.oracles.classify(market_id="morpho-usdc-lending")
print("freshness", freshness_status_of(oracle))
```

Resources mirror the API surface — `client.oracles`, `client.yield_opportunities`, `client.portfolio`, `client.webhooks`, and more.

## Async client

For high-throughput callers, the async client (installed via the `[async]` extra) has the same surface and supports streaming pagination:

```python theme={null}
import asyncio
from alterscope import AsyncAlterscopeClient

async def main():
    async with AsyncAlterscopeClient(api_key="sk_live_...") as client:
        async for opp in client.yield_opportunities.list_all(net_apy_min=20):
            print(f"{opp.name}: {opp.apy.net}%")

asyncio.run(main())
```

## Provenance

Every release ships a `PROVENANCE.md` recording the OpenAPI SHA-256 it was generated from plus the generator version, so if the SDK and the API ever drift you can tell which side is stale.

## Real-time and webhooks

For WebSocket subscriptions and signed-webhook verification, see [Realtime → WebSockets](/develop/realtime/websockets) and [Webhooks](/develop/realtime/webhooks).
