TokenLab

Frameworks & Platforms

Semantic Kernel

Connect Microsoft Semantic Kernel to TokenLab with a custom OpenAI-compatible endpoint

Overview

Semantic Kernel can call TokenLab through its OpenAI custom endpoint chat completion service.

Environment

export TOKENLAB_API_KEY="sk-your-tokenlab-key"

.NET Kernel Builder

Semantic Kernel's custom endpoint should point to the root OpenAI-compatible /v1 endpoint, not /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();

Basic Prompt

var result = await kernel.InvokePromptAsync(
    "Give me a concise checklist for evaluating an LLM gateway.");

Console.WriteLine(result);

Endpoint Notes

Use:

https://api.tokenlab.sh/v1

Do not use:

https://api.tokenlab.sh/v1/chat/completions

Semantic Kernel adds the chat completions path automatically for this connector.

On this page