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

> 사용자 지정 OpenAI 호환 엔드포인트를 사용하여 Microsoft Semantic Kernel을 TokenLab에 연결

## 개요

Semantic Kernel은 OpenAI 사용자 지정 엔드포인트 채팅 완성(chat completion) 서비스를 통해 TokenLab을 호출할 수 있습니다.

<Note>
  **유형**: SDK / 에이전트 프레임워크

  **기본 경로**: OpenAI 호환 채팅 완성

  **지원 신뢰도**: 지원되는 사용자 지정 엔드포인트 경로
</Note>

## 환경 설정

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

## .NET Kernel Builder

Semantic Kernel의 사용자 지정 엔드포인트는 `/v1/chat/completions`가 아닌 OpenAI 호환 루트 `/v1` 엔드포인트를 가리켜야 합니다.

```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();
```

## 기본 프롬프트

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

Console.WriteLine(result);
```

## 엔드포인트 참고 사항

사용:

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

사용 금지:

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

Semantic Kernel은 이 커넥터에 대해 내부적으로 채팅 완성 경로를 자동으로 추가합니다.
