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

# Python SDK 安装

> 安装和设置 Phaseo Python SDK 的方法。

该 SDK 以 [`phaseo`](https://pypi.org/project/phaseo/) 的名称发布在 PyPI。

## 安装

使用你偏好的 Python 包管理器安装 SDK：

<CodeGroup>
  ```bash title="pip" theme={null}
  pip install phaseo
  ```

  ```bash title="uv" theme={null}
  uv add phaseo
  ```
</CodeGroup>

## 要求

* Python 3.10+

## 设置

### API 密钥

在 [Phaseo 控制台](https://phaseo.app/gateway/keys)中创建 API 密钥。

### 环境变量

```bash theme={null}
export PHASEO_API_KEY="phaseo_v1_sk_<kid>_<secret>"
```

### 基本用法

```python theme={null}
from phaseo import Phaseo
import os

client = Phaseo(api_key=os.environ["PHASEO_API_KEY"])

response = client.generate_text(
    {
        "model": "openai/gpt-5-nano",
        "messages": [{"role": "user", "content": "Hello!"}],
    }
)

print(response["choices"][0]["message"]["content"])
```

### 可选客户端配置

```python theme={null}
from phaseo import Phaseo

client = Phaseo(
    api_key="your-api-key",
    base_url="https://api.phaseo.app/v1",
    timeout=30.0,
)
```

## 后续步骤

* 查看[使用指南](./usage.mdx)
* 浏览 [API 参考](../../api-reference/introduction.mdx)


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