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

# Python SDK

> Official OFAuth Python SDK — Pydantic v2 models, functional API, httpx-based

```bash theme={null}
pip install onlyfans-sdk
```

## Quick Example

```python theme={null}
from onlyfans_sdk import OFAuthClient, account

client = OFAuthClient(api_key="your-api-key")

result = account.whoami(client)
print(result["id"], result["permissions"])
```

## Details

|                  | Python                                                                   |
| ---------------- | ------------------------------------------------------------------------ |
| **Package**      | `onlyfans-sdk`                                                           |
| **Repository**   | [onlyfans-sdk-python](https://github.com/OFAuth-org/onlyfans-sdk-python) |
| **Init**         | `OFAuthClient()`                                                         |
| **Architecture** | Functional modules + client                                              |
| **Types**        | Pydantic v2 models                                                       |
| **Pagination**   | Generators (`for ... in`)                                                |
| **Dependencies** | `httpx`                                                                  |

## Features

<CardGroup cols={2}>
  <Card title="Pydantic Models" icon="code">
    All responses are validated Pydantic v2 models with full type hints.
  </Card>

  <Card title="Generator Pagination" icon="arrows-rotate">
    `for ... in` over any paginated list automatically.
  </Card>

  <Card title="Proxy Support" icon="globe">
    Call any OnlyFans endpoint directly through the OFAuth proxy.
  </Card>

  <Card title="Media Upload" icon="cloud-arrow-up">
    Automatic chunking and progress callbacks.
  </Card>
</CardGroup>

## Usage Examples

### List subscribers

```python theme={null}
from onlyfans_sdk import access

subscribers = access.list_subscribers(
    client,
    connection_id="conn_xxx",
    limit=20
)

for sub in subscribers["data"]:
    print(sub["username"], sub["subscribed_at"])
```

### Send a message

```python theme={null}
access.send_message(
    client,
    connection_id="conn_xxx",
    user_id="12345",
    text="Hello from OFAuth!"
)
```

### Error handling

```python theme={null}
from onlyfans_sdk import OFAuthError

try:
    access.get_user(client, connection_id="conn_xxx", user_id="999")
except OFAuthError as e:
    print(e.status, e.code, e.message)
```
