Skip to main content
Send text, embeddings, and model-discovery requests with the Java SDK.
The current source includes retry controls and response metadata that are absent from the older 3.0.0 artifact on Maven Central. Build the pinned source below to use the current SDK. Installation

Supported requests

Use createResponse, createChatCompletion, createEmbedding, and listModels for JSON requests. Pass a Map or JsonNode; parse JSON strings before passing them to wrapper methods.
For file uploads, audio transcription/translation, and image edits, use the direct multipart HTTP examples in this guide. The SDK’s JSON helpers do not encode multipart file bodies.

Streaming

streamResponse and rawClient().requestLines return SSE lines as they arrive. Close the stream with try-with-resources and handle event names, data lines, and completion markers in your application.
The createSpeech wrapper expects JSON and cannot decode binary audio. Use rawClient().requestBytes for speech output.

Next steps

Last modified on October 18, 2026