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

# AutoGen

> OpenAI 호환 클라이언트를 통해 Microsoft AutoGen에서 TokenLab 모델 사용하기

## 개요

AutoGen은 다른 커스텀 Chat Completions 엔드포인트와 동일한 OpenAI 호환 클라이언트 경로인 `OpenAIChatCompletionClient`를 통해 TokenLab을 사용할 수 있습니다.

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

  **기본 경로**: OpenAI 호환 chat completions

  **지원 신뢰도**: 지원되는 커스텀 엔드포인트 경로
</Note>

## 설치

```bash theme={null}
pip install -U autogen-agentchat "autogen-ext[openai]" pyyaml
```

## 환경 설정

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

## YAML 모델 설정

TokenLab의 `/v1` 엔드포인트를 `base_url`로 사용합니다:

```yaml theme={null}
provider: autogen_ext.models.openai.OpenAIChatCompletionClient
config:
  model: claude-sonnet-5
  base_url: https://api.tokenlab.sh/v1
  api_key: ${TOKENLAB_API_KEY}
  model_info:
    function_calling: true
    json_output: true
    vision: false
    family: claude
```

## Python 클라이언트

```python theme={null}
import os

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

model_client = OpenAIChatCompletionClient(
    model="claude-sonnet-5",
    base_url="https://api.tokenlab.sh/v1",
    api_key=os.environ["TOKENLAB_API_KEY"],
    model_info={
        "function_calling": True,
        "json_output": True,
        "vision": False,
        "family": "claude",
    },
)

agent = AssistantAgent("assistant", model_client=model_client)
```

## 엔드포인트 참고 사항

AutoGen의 OpenAI 확장 기능은 OpenAI 호환 요청 형식을 기대합니다. Anthropic Messages나 Gemini `generateContent`와 같은 공급자 고유 기능을 사용하려면, 해당 프로토콜을 직접 지원하는 클라이언트에서 TokenLab의 네이티브 엔드포인트를 사용하십시오.
