Skip to content

Repository files navigation

openapi-java-client

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

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

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.

Maven users

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>

Gradle users

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"
}

Others

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

Getting Started

Please follow the installation instruction and execute the following Java code:

packageai.wavespeed.client;
importai.wavespeed.openapi.client.ApiException;
importai.wavespeed.openapi.client.model.Prediction;
importjava.util.HashMap;
importjava.util.Map;
publicclassMain {
publicstaticvoidmain(String[] args) throwsInterruptedException {
WaveSpeedwaveSpeed = newWaveSpeed("your-api-key");
Map<String, Object> input = newHashMap<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);
Predictionprediction = waveSpeed.run("wavespeed-ai/flux-dev", input);
System.out.println(prediction);
Predictionprediction2 = 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 (ApiExceptione) {
thrownewRuntimeException(e);
}
}
}

Documentation for API Endpoints

All URIs are relative to https://api.wavespeed.ai/api/v2

ClassMethodHTTP requestDescription
DefaultApicreatePredictionPOST /{model_id}Generate an image using the specified model
DefaultApigetPredictionGET /predictions/{predictionId}/resultRetrieve the result of a prediction

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: HTTP Bearer Token authentication

Recommendation

It's recommended to create an instance of WaveSpeed per thread in a multithreaded environment to avoid any potential issues.

Author

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages