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

# SDK OpenAI Agents

> Utilisez les modèles TokenLab avec le SDK OpenAI Agents

## Aperçu

Le SDK OpenAI Agents peut utiliser TokenLab via un client compatible OpenAI et `OpenAIChatCompletionsModel`.

<Note>
  **Type** : Python Agent SDK

  **Chemin principal** : Chat completions compatibles OpenAI

  **Niveau de support** : Chemin chat-completions supporté
</Note>

## Environnement

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
export TOKENLAB_BASE_URL="https://api.tokenlab.sh/v1"
export TOKENLAB_MODEL="gpt-5.4-mini"
```

## Exemple

```python theme={null}
import asyncio
import os

from openai import AsyncOpenAI

from agents import Agent, OpenAIChatCompletionsModel, Runner, set_tracing_disabled

client = AsyncOpenAI(
    base_url=os.getenv("TOKENLAB_BASE_URL", "https://api.tokenlab.sh/v1"),
    api_key=os.environ["TOKENLAB_API_KEY"],
)

set_tracing_disabled(disabled=True)


async def main():
    agent = Agent(
        name="Assistant",
        instructions="You are concise and practical.",
        model=OpenAIChatCompletionsModel(
            model=os.getenv("TOKENLAB_MODEL", "gpt-5.4-mini"),
            openai_client=client,
        ),
    )

    result = await Runner.run(agent, "Explain custom model providers in one paragraph.")
    print(result.final_output)


asyncio.run(main())
```

## Portée

Ce chemin utilise la compatibilité Chat Completions. Le point de terminaison natif Responses de TokenLab est disponible à l'adresse `https://api.tokenlab.sh/v1/responses`, mais les fonctionnalités du SDK qui dépendent de la sémantique Responses spécifique à OpenAI doivent être vérifiées avec le modèle et le flux de travail exacts avant toute utilisation en production.
