> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

<Note>
  **Type**: SDK / Agent Framework

  **Primary Path**: OpenAI-compatible chat completions

  **Support Confidence**: Supported custom endpoint path
</Note>

## Environment

```bash theme={null}
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`.

```csharp theme={null}
using Microsoft.SemanticKernel;

#pragma warning disable SKEXP0010

var builder = Kernel.CreateBuilder();

builder.AddOpenAIChatCompletion(
    modelId: "gpt-5.4-mini",
    endpoint: new Uri("https://api.tokenlab.sh/v1"),
    apiKey: Environment.GetEnvironmentVariable("TOKENLAB_API_KEY"));

var kernel = builder.Build();
```

## Basic Prompt

```csharp theme={null}
var result = await kernel.InvokePromptAsync(
    "Give me a concise checklist for evaluating an LLM gateway.");

Console.WriteLine(result);
```

## Endpoint Notes

Use:

```text theme={null}
https://api.tokenlab.sh/v1
```

Do not use:

```text theme={null}
https://api.tokenlab.sh/v1/chat/completions
```

Semantic Kernel appends the chat completions path internally for this connector.
