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

# Python SDK Overview

> Official Python SDK for HTTPayer - handle 402 Payment Required responses

## Introduction

The HTTPayer Python SDK provides a simple interface for accessing 402-protected APIs using either proxy mode (API key) or relay mode (private key).

## Installation

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

## Quick Start

### Proxy Mode

```python theme={null}
from httpayer import HTTPayerClient

client = HTTPayerClient()  # Uses HTTPAYER_API_KEY from environment
response = client.request("GET", "https://api.example.com/protected")
print(response.json())
```

### Relay Mode

```python theme={null}
import os
from httpayer import HTTPayerClient

client = HTTPayerClient(
    private_key=os.getenv("EVM_PRIVATE_KEY")
)
response = client.request("GET", "https://api.example.com/protected")
print(response.json())
```

### Direct Mode

When `privacy_mode=False`, the SDK does not call the HTTPayer server, it attempts to call the target API directly. Ideal for when you don't need cross-chain or privacy. If the target API returns payment instructions on the selected network, the SDK will pay them directly.

```python theme={null}
import os
from httpayer import HTTPayerClient

client = HTTPayerClient(
    private_key=os.getenv("EVM_PRIVATE_KEY"),
    privacy_mode=False
)
response = client.request("GET", "https://api.example.com/protected")
print(response.json())
```

## Key Features

* **Multiple Access Patterns**: Proxy (API key), Relay (private key + privacy/cross-chain), or Direct (private key, no relay, single-chain)
* **Auto-handles 402**: Automatically processes payment flows
* **Cross-chain Support**: Pay on one chain, access APIs on another
* **Privacy Mode**: Route payments through HTTPayer relay
* **Simulation**: Preview costs without executing payments

## Next Steps

* [Installation Guide](/sdks/python/installation)
* [API Reference](/sdks/python/api-reference/client)
