Setup
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:
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.
Last modified on May 6, 2026