フレームワークとプラットフォーム

Portkey Gateway

Portkey GatewayでTokenLabをアップストリームプロバイダーとして使用する

概要

Portkey で TokenLab を OpenAI 互換のカスタムホストとして設定します。Responses は、使用中の Portkey バージョンがカスタム Responses エンドポイントに対応している場合にのみ使用してください。

プロバイダー値

フィールド値
Provideropenai
Custom Hosthttps://api.tokenlab.sh/v1
API keysk-your-tokenlab-key
モデル現在利用可能な TokenLab モデル ID

チャット補完 (Chat Completions)

OpenAI互換のチャットリクエストにTokenLabを使用します:

この例には稼働中のセルフホスト版 Portkey Gateway が必要です。ゲートウェイ URL を実際のデプロイ先に置き換えてください。Portkey Cloud を使う場合は、Portkey API キーを x-portkey-api-key ヘッダーでも送信します。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 URL に対応している場合は、モデルページで現在利用可能な Responses 対応モデルを選び、/v1/responses を使用してください。

ネイティブエンドポイントに関する注意

Anthropic Messages と Gemini を Portkey 経由で使用できるのは、使用中の Portkey バージョンがそれらの形式のカスタム URL に対応している場合のみです。

このページの内容