All URIs are relative to https://api.wavespeed.ai/api/v2
| Method | HTTP request | Description |
|---|---|---|
| createPredictionData | POST /{model_id} | Generate an image using the specified model |
| getPredictionData | GET /predictions/{predictionId}/result | Retrieve the result of a prediction |
PredictionResponse createPredictionData(modelId, requestBody, webhook)
Generate an image using the specified model
This endpoint generates an image based on the provided parameters. The `model_id` is a required path parameter specifying the model to use. The request body can contain various key-value pairs to customize the model generation process.
// Import classes:
import ai.wavespeed.openapi.client.ApiClient;
import ai.wavespeed.openapi.client.ApiException;
import ai.wavespeed.openapi.client.Configuration;
import ai.wavespeed.openapi.client.auth.*;
import ai.wavespeed.openapi.client.models.*;
import ai.wavespeed.openapi.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.wavespeed.ai/api/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
DefaultApi apiInstance = new DefaultApi(defaultClient);
String modelId = "modelId_example"; // String | The ID of the model to use for image generation
Map<String, Object> requestBody = null; // Map<String, Object> |
String webhook = "webhook_example"; // String | The URL to which the webhook will be sent
try {
PredictionResponse result = apiInstance.createPredictionData(modelId, requestBody, webhook);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#createPredictionData");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| modelId | String | The ID of the model to use for image generation | |
| requestBody | Map<String, Object> | ||
| webhook | String | The URL to which the webhook will be sent | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Image generation successful | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 500 | Internal Server Error | - |
PredictionResponse getPredictionData(predictionId)
Retrieve the result of a prediction
This endpoint retrieves the result of a prediction based on the provided request ID.
// Import classes:
import ai.wavespeed.openapi.client.ApiClient;
import ai.wavespeed.openapi.client.ApiException;
import ai.wavespeed.openapi.client.Configuration;
import ai.wavespeed.openapi.client.auth.*;
import ai.wavespeed.openapi.client.models.*;
import ai.wavespeed.openapi.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.wavespeed.ai/api/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
DefaultApi apiInstance = new DefaultApi(defaultClient);
String predictionId = "predictionId_example"; // String | The ID of the prediction request
try {
PredictionResponse result = apiInstance.getPredictionData(predictionId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#getPredictionData");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| predictionId | String | The ID of the prediction request |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Image generation successful | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 500 | Internal Server Error | - |