Skip to main content
Method: client.createChatCompletion(...)
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));
Last modified on May 6, 2026