TokenLab

框架與平台

Portkey Gateway

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

概覽

在 Portkey 中將 TokenLab 設定為自訂 OpenAI 相容服務。只有目前的 Portkey 版本支援自訂 Responses 位址時,才使用 Responses。

類型: AI Gateway

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

支援信心: 支援的路徑

提供者數值

欄位數值
Provideropenai
Custom Hosthttps://api.tokenlab.sh/v1
API keysk-your-tokenlab-key
模型目前可用的 TokenLab 模型 ID

聊天補全 (Chat Completions)

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

此範例需要已執行的自架 Portkey Gateway,請將閘道 URL 替換為你的部署位址。使用 Portkey Cloud 時,還需透過 x-portkey-api-key 傳送 Portkey API 金鑰。參見 Portkey 設定指南。

curl https://your-portkey-gateway.example/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "x-portkey-provider: openai" \
  -H "x-portkey-custom-host: https://api.tokenlab.sh/v1" \
  -H "Authorization: Bearer sk-your-tokenlab-key" \
  -d '{
    "model": "gpt-5.6-luna",
    "messages": [{"role": "user", "content": "Say hello from TokenLab."}]
  }'

Responses

如果目前的 Portkey 版本支援自訂 Responses 位址,請從模型頁選擇目前可用且支援 Responses 的模型,並使用 /v1/responses。

原生端點注意事項

只有目前的 Portkey 版本支援這些格式的自訂位址時,才能透過 Portkey 使用 Anthropic Messages 和 Gemini。

本頁內容