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

# Chat completions

> Call /chat/completions with the Java SDK.

**Method**: `client.createChatCompletion(...)`

```java theme={null}
import ai.stats.sdk.AIStats;

AIStats client = new AIStats(System.getenv("AI_STATS_API_KEY"));

String body = """
{
  "model": "openai/gpt-5-nano",
  "messages": [
    { "role": "user", "content": "Write a one-line haiku." }
  ]
}
""";

Object response = client.createChatCompletion(body);
System.out.println(String.valueOf(response));
```
