WaveSpeed AI API
- API version: 0.0.1
- Build date: 2025-04-07T16:39:33.625926313+08:00[Asia/Shanghai]
- Generator version: 7.10.0
API for generating images using WaveSpeed AI
Automatically generated by the OpenAPI Generator
Building the API client library requires:
- Java 1.8+
- Maven (3.8.3+)/Gradle (7.2+)
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>ai.wavespeed.maven</groupId>
<artifactId>wavespeed-client</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
repositories {
mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central.
mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo.
}
dependencies {
implementation "ai.wavespeed.maven:wavespeed-client:0.0.1"
}
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/wavespeed-client-0.0.1.jar
target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
package ai.wavespeed.client;
import ai.wavespeed.openapi.client.ApiException;
import ai.wavespeed.openapi.client.model.Prediction;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws InterruptedException {
WaveSpeed waveSpeed = new WaveSpeed("your-api-key");
Map<String, Object> input = new HashMap<String, Object>();
input.put("enable_base64_output", true);
input.put("enable_safety_checker", true);
input.put("guidance_scale", 3.5);
input.put("num_images", 1);
input.put("num_inference_steps", 28);
input.put("prompt", "Girl in red dress, hilltop, white deer, rabbits, sunset, japanese anime style");
input.put("seed", -1);
input.put("size", "1024*1024");
input.put("strength", 0.8);
try {
System.out.println(input);
Prediction prediction = waveSpeed.run("wavespeed-ai/flux-dev", input);
System.out.println(prediction);
Prediction prediction2 = waveSpeed.create("wavespeed-ai/flux-dev", input);
while (prediction2.getStatus() != Prediction.StatusEnum.COMPLETED && prediction2.getStatus() != Prediction.StatusEnum.FAILED) {
Thread.sleep(2000);
System.out.println("query status: " + prediction2.getStatus());
prediction2 = waveSpeed.getPrediction(prediction2.getId());
}
System.out.println(prediction2);
} catch (ApiException e) {
throw new RuntimeException(e);
}
}
}
All URIs are relative to https://api.wavespeed.ai/api/v2
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | createPrediction | POST /{model_id} | Generate an image using the specified model |
DefaultApi | getPrediction | GET /predictions/{predictionId}/result | Retrieve the result of a prediction |
- CreatePrediction400Response
- CreatePrediction400ResponseData
- CreatePrediction401Response
- CreatePrediction500Response
- Prediction
- PredictionResponse
- PredictionUrls
Authentication schemes defined for the API:
- Type: HTTP Bearer Token authentication
It's recommended to create an instance of WaveSpeed
per thread in a multithreaded environment to avoid any potential issues.