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

# 认证

> Relay 的 API Key、请求头和 Base URL。

所有公共 Relay 路由都使用 [console.pipellm.ai](https://console.pipellm.ai) 里的 API Key。不要上传厂商自己的 Key；Relay 用你的账号鉴权，再路由到上游。

## 默认路径

OpenAI 兼容对话使用：

| | |
| - | - |
| Base URL | `https://api.pipellm.ai/v1` |
| Header | `Authorization: Bearer $PIPELLM_API_KEY` |

```bash theme={"dark"}
curl https://api.pipellm.ai/v1/chat/completions \
  -H "Authorization: Bearer $PIPELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5","messages":[{"role":"user","content":"你好"}]}'
```

视频使用同一个 Bearer 头，Base URL 是 `https://api.pipellm.ai`（没有 `/v1` 前缀）：

```bash theme={"dark"}
curl https://api.pipellm.ai/v2/videos \
  -H "Authorization: Bearer $PIPELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"seedance-2-0-mini","prompt":"一只猫在雨中走路"}'
```

## 协议对应的请求头

原生路由沿用对应 SDK 期望的 Header：

| 请求格式 | Base URL | Header |
| - | - | - |
| OpenAI Chat Completions / Responses | `https://api.pipellm.ai/v1` | `Authorization: Bearer $PIPELLM_API_KEY` |
| Anthropic Messages | `https://api.pipellm.ai` | `x-api-key: $PIPELLM_API_KEY` |
| Gemini Generate Content | `https://api.pipellm.ai` | `x-goog-api-key: $PIPELLM_API_KEY` |
| 视频（`/v2/videos`） | `https://api.pipellm.ai` | `Authorization: Bearer $PIPELLM_API_KEY` |

Anthropic 请求还需要 `anthropic-version: 2023-06-01`。

## Converter 路由

只有在「保留一种 SDK 格式、去调用另一个协议族的模型」时才使用 converter Base URL。详见 [路由与协议](/zh/guides/routing-protocols)。

| 格式 | Base URL |
| - | - |
| OpenAI converter | `https://api.pipellm.ai/openai/v1` |
| OpenAI Responses converter | `https://api.pipellm.ai/responses/v1` |
| Anthropic converter | `https://api.pipellm.ai/anthropic` |
| Gemini converter | `https://api.pipellm.ai/gemini` |

## 认证失败

缺少或无效的 Key 返回 `401`：

```json theme={"dark"}
{
  "error": {
    "type": "authentication_error",
    "code": "401",
    "message": "Incorrect API key provided. Please visit https://console.pipellm.ai/account/api-keys to find your API key."
  }
}
```

完整错误信封见 [错误](/zh/api-reference/errors)。


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