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

# Python Installation

> Get our SDK up and running in your Python environment

### Requirements

Python 3.8+ is required to ensure proper functionality of all necessary libraries.

As best practice, it is recommended to set up your environment variables as such:

```bash theme={null}
export VALENCE_API_KEY= "api_key_here"
export VALENCE_DISCRETE_URL= "https://discrete-api-url" # Optional: custom Discrete audio endpoint
export VALENCE_ASYNCH_URL= "https://asynch-api-url" # Optional: custom Asynch audio endpoint
export VALENCE_LOG_LEVEL= "DEBUG"  # Optional: INFO, DEBUG, ERROR
```

Your Valence API Key is required, while while all other fields are optional.

### Usage

Install the package via `pip`.

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

**Client Constructor:**

```python theme={null}
from valenceai import ValenceClient

client = ValenceClient(
    api_key=None,           # API key (or use VALENCE_API_KEY env var)
    part_size=5*1024*1024,  # Size of each upload chunk for asynch audio
    show_progress=True,     # Show progress bar for asynch uploads
    max_threads=3          # Number of concurrent threads for asynch uploads
)
```

**DiscreteAPI:**

```python theme={null}
from valenceai import ValenceClient

client = ValenceClient()
result = client.discrete.emotions("YOUR_FILE.wav")
print(result)
```

**AsynchAPI:**

```python theme={null}
from valenceai import ValenceClient

client = ValenceClient(show_progress=True)
request_id = client.asynch.upload("YOUR_FILE.wav")

# Get emotions from uploaded audio
result = client.asynch.emotions(request_id)
print(result)
```

More information about additional parameters and expected values can be found in the [API Reference](/api-reference/introduction).

<Card title="Ready to Get Started?" icon="rectangle-code" href="https://pypi.org/project/valenceai/">
  Check out the Valence package on PyPI →
</Card>
