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

# 管理你的 API Key

> 创建、查看和管理 Anyone API key，控制不同项目的用量。

API key 是你调用 Anyone API 的凭证。每个 API key 都有独立的用量统计，你可以为不同项目创建不同的 API key。

## 创建 API Key

1. 登录 [anyone.ai](https://www.anyone.ai) 控制台
2. 点击左侧菜单的 **API keys**
3. 点击 **创建 API key**
4. 填写名称（方便识别用途，如"个人项目"、"公司项目"）
5. 可选：设置额度上限和过期时间
6. 点击 **提交**，复制生成的 token

<Warning>
  API key 只在创建时显示一次。请妥善保存，丢了只能重新创建。
</Warning>

## 使用 API Key

在 API 请求的 `Authorization` 头中传入你的 API key：

```bash theme={null}
curl https://api.anyone.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-你的token" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.4", "messages": [{"role": "user", "content": "hi"}]}'
```

或者在 SDK 中设置：

```python theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.anyone.ai/v1",
    api_key="sk-你的token",
)
```

## 查看用量

在控制台点击具体 API key 可以查看：

* 已消耗额度
* 剩余额度
* 请求历史

## 安全建议

* **不要把 API key 写在前端代码里** — API key 应该只在后端使用
* **不同项目用不同 API key** — 方便追踪用量，万一泄露也只影响一个
* **定期轮换** — 可以创建新 API key 替换旧的，旧的随时删除
* **泄露了立刻删** — 在控制台点击 API key 旁的删除按钮即可
