> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Complétions de chat

> Appelez /chat/completions avec le SDK C#.

**Méthode** : `client.GenerateText(...)` ou `client.CreateChatCompletion(...)`

### Exemple

```csharp theme={null}
using PhaseoSdk;

var client = new Phaseo(apiKey);
var response = await client.GenerateText(new Dictionary<string, object>
{
    ["model"] = "openai/gpt-5-nano",
    ["messages"] = new[]
    {
        new Dictionary<string, object>
        {
            ["role"] = "user",
            ["content"] = "Write a limerick about lighthouses."
        }
    }
});
```

### Paramètres clés

* `model` (obligatoire) : ID du modèle cible.
* `messages` (obligatoire) : messages ordonnés avec les rôles `system|user|assistant|tool` ; le contenu peut être du texte ou des parties.
* Échantillonnage : `temperature` (0–2), `top_p` (0–1), `top_k` (>=1), `seed` (entier, facultatif).
* Longueur et pénalités : `max_output_tokens` (entier), `presence_penalty` et `frequency_penalty` (-2 à 2), `stop` (string|string\[]).
* Outils : `tools` (définitions), `tool_choice` (auto/none/outils spécifique), `max_tool_calls` (entier), `parallel_tool_calls` (booléen).
* Logprobs : `logprobs` (booléen), `top_logprobs` (0–20).
* Sortie : `response_format` (json/text), `meta` (objet transmisible), `stream` (booléen), `service_tier`.
* Options Gateway supplémentaires : `usage` (booléen pour demander l’utilisation), `meta` (booléen pour inclure le bloc meta).

### Retour

`ChatCompletionsResponse`

```json theme={null}
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello there, how may I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.