> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.multion.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.multion.ai/_mcp/server.

# Python SDK

> MultiOn for Python

## Installation

```bash
pip install multion
# or
poetry add multion
```

## Usage

Simply import MultiOn and start making calls to our API.

```python
from multion.client import MultiOn

client = MultiOn(
    api_key="YOUR_API_KEY" # defaults to os.getenv("MULTION_API_KEY")
)
response = client.browse(
    url="https://google.com"
)
```

## Async Client

The SDK also exports an async client so that you can make non-blocking
calls to our API.

```python
from multion.client import AsyncMultiOn

client = AsyncMultiOn(
    api_key="YOUR_API_KEY" # defaults to os.getenv("MULTION_API_KEY")
)

async def main() -> None:
    await response = client.browse(
        url="https://google.com"
    )

asyncio.run(main())
```

## Exception Handling

All errors thrown by the SDK will be subclasses of `ApiError`.

```python
import multion

try:
    client.browse(...)
except multion.core.ApiError as e: # handle all errors
    print(e.status_code)
    print(e.body)
```

## Advanced

### Retries

The MultiOn SDK is instrumented with automatic retries with exponential backoff. A request will be
retried as long as the request is deemed retriable and the number of retry attempts has not grown larger
than the configured retry limit.

A request is deemed retriable when any of the following HTTP status codes is returned:

* [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
* [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
* [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

Use the `max_retries` request option to configure this behavior.

```python
from multion.client import MultiOn

client = MultiOn()

client.browse(url="https://google.com", {
    max_retries=1 # override retries for a specific method
})
```

### Timeouts

By default, requests time out after 60 seconds. You can configure this with a
timeout option at the client or request level.

```python
from multion.client import MultiOn

client = MultiOn(
    timeout=30.0, # all timeouts are 30 seconds
)

client.brwose(url="https://google.com", {
    timeout_in_seconds=30.0 # override timeout for a specific method
})
```

### Custom HTTP client

You can override the httpx client to customize it for your use-case. Some common use-cases
include support for proxies and transports.

```python
import httpx

from multion.client import MultiOn

client = MultiOn(
    http_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)
```

#### [GitHub](https://github.com/MULTI-ON/multion-python)

#### [PyPi](https://pypi.org/project/multion/)