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

> Connectez Microsoft Semantic Kernel à TokenLab avec un endpoint personnalisé compatible OpenAI

## Aperçu

Semantic Kernel peut appeler TokenLab via son service de complétion de chat sur endpoint personnalisé OpenAI.

<Note>
  **Type** : SDK / Framework d'agent

  **Chemin principal** : Complétions de chat compatibles OpenAI

  **Niveau de support** : Chemin d'endpoint personnalisé supporté
</Note>

## Environnement

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## .NET Kernel Builder

L'endpoint personnalisé de Semantic Kernel doit pointer vers l'endpoint racine `/v1` compatible OpenAI, et non vers `/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();
```

## Prompt de base

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

Console.WriteLine(result);
```

## Remarques sur l'endpoint

Utilisez :

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

N'utilisez pas :

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

Semantic Kernel ajoute automatiquement le chemin des complétions de chat en interne pour ce connecteur.
