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

# Introduction & Installation

> [card] [Open Source SDK](https://github.com/Chainlit/literalai-python)
>
> Check out the open-source Github Repo

### Introduction

In addition to the Python SDK documentation, all [Guides](https://docs.literalai.com/guides/) showcase code examples in Python.

### Installation

To install the Python client, run the following command:

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

You can use either the **synchronous** or **asynchronous** Literal AI Python client.

All APIs can be used both sync or async, except for functions on `Dataset`, which are always sync. All examples in the documentation are, for simplicity, using the synchronous client.

If you want to use the async functions, make sure to `await` the functions.

> [!WARNING]
>
> The Python client is not compatible with gunicorn's `--preload` flag.

To instantiate the synchronous client:

```python theme={null}
import os
from literalai import LiteralClient

literalai_client = LiteralClient(api_key=os.getenv("LITERAL_API_KEY")) 
```

or, async:

```python theme={null}
import os
from literalai import AsyncLiteralClient

async_literalai_client = AsyncLiteralClient(api_key=os.getenv("LITERAL_API_KEY")) 
```

Additionally, you can pass the optional `batch_size` argument to batch multiple events - handled simultaneously by Literal.
Events are batched up to `batch_size`. Defaults to 5.

#### Disable Logging

When instantiating the client, you have the option to disable logging. This can be useful when you want to disable the logs without changing the code.

```python theme={null}
import os
from literalai import LiteralClient

literalai_client = LiteralClient(api_key=os.getenv("LITERAL_API_KEY"), disabled=True) # Disable decorators
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.