> ## 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.

# 安装 Rust SDK

> 从 crates.io 安装 phaseo 并配置 Phaseo Gateway 身份验证。

按照本指南添加受支持的 Rust 客户端，并在应用中使用它。

## 要求

* Rust 1.86 或更高版本
* Phaseo Gateway API 密钥

## 安装

添加客户端和 JSON 依赖项：

```toml theme={null}
[dependencies]
phaseo = "0.1"
serde_json = "1"
```

或者运行：

```bash theme={null}
cargo add phaseo@0.1 serde_json
```

## 配置 API 密钥

`Phaseo::from_env()` 会读取 `PHASEO_API_KEY`：

```bash theme={null}
export PHASEO_API_KEY="phaseo_v1_sk_..."
```

PowerShell：

```powershell theme={null}
$env:PHASEO_API_KEY = "phaseo_v1_sk_..."
```

请将密钥保存在服务器上。不要将密钥编译进桌面、移动端、浏览器或其他分发客户端。

## 验证安装

```rust theme={null}
use phaseo::Phaseo;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let _client = Phaseo::from_env()?;
    println!("Phaseo Rust client configured");
    Ok(())
}
```

```bash theme={null}
cargo run
```

## 自定义端点

如果要用开发或代理端点替换 `https://api.phaseo.app/v1`，请设置 `PHASEO_BASE_URL`：

```bash theme={null}
export PHASEO_BASE_URL="http://localhost:8787/v1"
```

远程端点必须使用 HTTPS。只有解析后的主机名与 `localhost` 或环回 IP 地址完全一致时才接受明文 HTTP。

## 后续步骤

* [发送请求](./usage.mdx)
* [Responses API](./responses.mdx)
* [Rust API 参考](./api-reference.mdx)


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