Class OpenAiImageApi
java.lang.Object
org.springframework.ai.openai.api.OpenAiImageApi
OpenAI Image API.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic enumOpenAI Image API model.static final recordstatic final record -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenAiImageApi(String openAiToken) Create a new OpenAI Image api with base URL set tohttps://api.openai.com.OpenAiImageApi(String baseUrl, String apiKey, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Image API with the provided base URL.OpenAiImageApi(String baseUrl, String openAiToken, org.springframework.web.client.RestClient.Builder restClientBuilder) Create a new OpenAI Image API with the provided base URL.OpenAiImageApi(String baseUrl, String apiKey, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Image API with the provided base URL. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<OpenAiImageApi.OpenAiImageResponse>createImage(OpenAiImageApi.OpenAiImageRequest openAiImageRequest)
-
Field Details
-
DEFAULT_IMAGE_MODEL
-
-
Constructor Details
-
OpenAiImageApi
Create a new OpenAI Image api with base URL set tohttps://api.openai.com.- Parameters:
openAiToken- OpenAI apiKey.
-
OpenAiImageApi
public OpenAiImageApi(String baseUrl, String openAiToken, org.springframework.web.client.RestClient.Builder restClientBuilder) Create a new OpenAI Image API with the provided base URL.- Parameters:
baseUrl- the base URL for the OpenAI API.openAiToken- OpenAI apiKey.restClientBuilder- the rest client builder to use.
-
OpenAiImageApi
public OpenAiImageApi(String baseUrl, String apiKey, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Image API with the provided base URL.- Parameters:
baseUrl- the base URL for the OpenAI API.apiKey- OpenAI apiKey.restClientBuilder- the rest client builder to use.responseErrorHandler- the response error handler to use.
-
OpenAiImageApi
public OpenAiImageApi(String baseUrl, String apiKey, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Image API with the provided base URL.- Parameters:
baseUrl- the base URL for the OpenAI API.apiKey- OpenAI apiKey.headers- the http headers to use.restClientBuilder- the rest client builder to use.responseErrorHandler- the response error handler to use.
-
-
Method Details
-
createImage
public org.springframework.http.ResponseEntity<OpenAiImageApi.OpenAiImageResponse> createImage(OpenAiImageApi.OpenAiImageRequest openAiImageRequest)
-