Skip to main content
Method: client.createSpeech(...)
import ai.stats.sdk.AIStats;

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

String body = """
{
  "model": "openai/gpt-4o-mini-tts",
  "input": "Hello from Java",
  "voice": "alloy",
  "format": "mp3"
}
""";

Object response = client.createSpeech(body);
System.out.println(String.valueOf(response));
Last modified on May 6, 2026