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

# Portkey Gateway

> 在 Portkey Gateway 中使用 TokenLab 作為上游提供者

## 概覽

Portkey Gateway 可以將請求路由至 TokenLab 作為上游提供者。最安全的預設方式是使用 OpenAI 相容的聊天補全（chat completions）；當您的 Portkey 版本為 TokenLab 開放該路徑時，請使用 Responses。

<Note>
  **類型**: AI Gateway

  **主要路徑**: OpenAI 相容的聊天補全與 Responses

  **支援信心**: 支援的路徑
</Note>

## 提供者數值

| 欄位            | 數值                           |
| ------------- | ---------------------------- |
| Provider      | `tokenlab`                   |
| Base URL      | `https://api.tokenlab.sh/v1` |
| API key       | `sk-your-tokenlab-key`       |
| Default model | `gpt-5.4-mini`               |

## 聊天補全 (Chat Completions)

使用 TokenLab 進行 OpenAI 相容的聊天請求：

```bash theme={null}
curl https://your-portkey-gateway.example/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "x-portkey-provider: tokenlab" \
  -H "Authorization: Bearer sk-your-tokenlab-key" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [{"role": "user", "content": "Say hello from TokenLab."}]
  }'
```

## Responses

如果您的 Portkey 組建路由 TokenLab Responses，請搭配 `/v1/responses` 使用 `gpt-5.5`、`gpt-5.4` 或 `gpt-5.4-mini`。

## 原生端點注意事項

TokenLab 也直接公開了 Anthropic Messages 和 Gemini 相容的端點。這些端點是否能透過 Portkey 使用，取決於您所部署版本中的 Portkey 提供者與端點支援情況。
