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

# Java SDK Usage

> How to initialize and use the Java SDK wrapper.

## Setup

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

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

## Pattern

Common wrapper calls look like this:

```java theme={null}
Object response = client.createChatCompletion("""
{
  "model": "openai/gpt-5-nano",
  "messages": [
    { "role": "user", "content": "Say hello from Java" }
  ]
}
""");
```

Wrapper methods return parsed JSON nodes for most JSON endpoints, and byte arrays for file/video content helpers.

## Recommended

* Use `ai.stats.sdk.AIStats` for the common gateway surfaces first.
* Drop to `ai.stats.gen.Client` and `ai.stats.gen.Operations` only when you need a lower-level operation that has not been promoted to the wrapper yet.
* Start from the endpoint-specific examples in this section for the current wrapper method names.
