框架與平台
Semantic Kernel
透過自訂 OpenAI 相容端點將 Microsoft Semantic Kernel 連接到 TokenLab
概覽
Semantic Kernel 可以透過其 OpenAI 自訂端點聊天完成服務(chat completion service)呼叫 TokenLab。
類型: SDK / Agent Framework
主要路徑: OpenAI 相容聊天完成(chat completions)
支援信心: 支援自訂端點路徑
環境
export TOKENLAB_API_KEY="sk-your-tokenlab-key".NET Kernel Builder
Semantic Kernel 的自訂端點應指向 OpenAI 相容的根目錄 /v1 端點,而非 /v1/chat/completions。
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();基本 Prompt
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 會在此連接器內部自動附加聊天完成路徑。