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

> Verwenden Sie TokenLab-Modelle mit Microsoft AutoGen über OpenAI-kompatible Clients

## Überblick

AutoGen kann TokenLab über den `OpenAIChatCompletionClient` nutzen, denselben OpenAI-kompatiblen Client-Pfad, den es auch für andere benutzerdefinierte Chat-Completions-Endpunkte verwendet.

<Note>
  **Typ**: Agent-Framework

  **Primärer Pfad**: OpenAI-kompatible Chat-Completions

  **Support-Status**: Unterstützter benutzerdefinierter Endpunkt-Pfad
</Note>

## Installation

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

## Umgebung

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

## YAML-Modellkonfiguration

Verwenden Sie den `/v1`-Endpunkt von TokenLab als `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-Client

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

## Hinweise zu Endpunkten

Die OpenAI-Erweiterung von AutoGen erwartet das OpenAI-kompatible Anfrageformat. Für anbieterspezifische Funktionen wie Anthropic Messages oder Gemini `generateContent` verwenden Sie bitte die nativen Endpunkte von TokenLab über einen Client, der diese Protokolle direkt unterstützt.
