Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

openapi-java-client

WaveSpeed AI API

  • API version: 0.0.1
    • Build date: 2025年04月07日T16: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:

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);
 }
 }
}

Documentation for API Endpoints

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

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

AltStyle によって変換されたページ (->オリジナル) /