フレームワークとプラットフォーム
Semantic Kernel
カスタムのOpenAI互換エンドポイントを使用して、Microsoft Semantic KernelをTokenLabに接続します
概要
Semantic Kernelは、OpenAI互換のカスタムエンドポイントチャット補完サービスを通じてTokenLabを呼び出すことができます。
環境設定
export TOKENLAB_API_KEY="sk-your-tokenlab-key".NET Kernel Builder
Semantic Kernelのカスタムエンドポイントは、/v1/chat/completions ではなく、OpenAI互換のルートエンドポイントである /v1 を指定する必要があります。
using Microsoft.SemanticKernel;
#pragma warning disable SKEXP0010
var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion(
modelId: "gpt-5.6-luna",
endpoint: new Uri("https://api.tokenlab.sh/v1"),
apiKey: Environment.GetEnvironmentVariable("TOKENLAB_API_KEY"));
var kernel = builder.Build();基本的なプロンプト
var result = await kernel.InvokePromptAsync(
"Give me a concise checklist for evaluating an LLM gateway.");
Console.WriteLine(result);エンドポイントに関する注意点
以下を使用してください:
https://api.tokenlab.sh/v1以下は使用しないでください:
https://api.tokenlab.sh/v1/chat/completionsSemantic Kernelは、このコネクタに対して内部的にチャット補完パスを付加します。