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

> Conecta Microsoft Semantic Kernel a TokenLab con un endpoint personalizado compatible con OpenAI

## Descripción general

Semantic Kernel puede llamar a TokenLab a través de su servicio de finalización de chat con endpoint personalizado de OpenAI.

<Note>
  **Tipo**: SDK / Framework de agentes

  **Ruta principal**: Finalizaciones de chat compatibles con OpenAI

  **Nivel de soporte**: Ruta de endpoint personalizado compatible
</Note>

## Entorno

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

## .NET Kernel Builder

El endpoint personalizado de Semantic Kernel debe apuntar a la raíz del endpoint `/v1` compatible con OpenAI, no a `/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 básico

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

Console.WriteLine(result);
```

## Notas sobre el endpoint

Utiliza:

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

No utilices:

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

Semantic Kernel añade la ruta de finalización de chat internamente para este conector.
