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

# Python

> Render prompt templates programmatically using the px0 Python SDK.

Integrate px0 into your Python application. This guide shows how to fetch and render a prompt template programmatically.

## Prerequisites

Before running the SDK, ensure you have completed the following steps:

* [Running px0 locally](/get-started/run-locally)
* [Getting an access key](/get-started/get-access-key)
* [Creating your first prompt](/get-started/create-prompt)

## Configuration

The Python SDK requires connection details and authentication to communicate with your px0 instance. Configure these details using environment variables.

* `PX0_HOST`: The URL of your px0 API instance.
* `PX0_ACCESS_TOKEN`: Your API access key.

Set these variables in your shell before running the applications:

```bash theme={null}
export PX0_HOST="http://localhost:8000"
export PX0_ACCESS_TOKEN="your_access_key_here"
```

## Installation

Install the required client library for Python.

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

## Hello World Example

The following example demonstrates how to load the client, authenticate, and render a live prompt template named `hello_world` with a dynamic `name` variable.

```python theme={null}
import os
import px0

host = os.getenv("PX0_HOST")
access_token = os.getenv("PX0_ACCESS_TOKEN")

config = px0.Configuration(
    host=host,
    access_token=access_token
)
api_client = px0.ApiClient(config)
renders_api = px0.PromptRendersApi(api_client)
response = renders_api.render_live(
    slug="hello_world",
    render_request=px0.RenderRequest(variables={"name": "World"})
)
print(response.rendered)
```

## Execution

Execute the Python script:

```bash theme={null}
python main.py
```
