This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
WaveSpeed Java SDK - Official Java SDK for WaveSpeedAI inference platform. Provides an API client for running models.
# Run all tests
mvn test
# Run a single test file
mvn test -Dtest=ClientTest
# Run a specific test
mvn test -Dtest=ClientTest#testInitWithApiKey -X# Build the project
mvn clean package
# Install to local Maven repository
mvn clean install
# Build without running tests
mvn clean package -DskipTests
# Compile only
mvn compileEntry point: Wavespeed.run(model, input) or new Client(apiKey)
Three execution modes:
- Module-level API -
Wavespeed.run()for convenience - Client instance -
new Client()for custom configuration - Static import -
import static ai.wavespeed.Wavespeed.*for concise usage
Key classes:
Wavespeed.java- Module-level API with static methodsapi/Client.java- Main client implementationConfig.java- Global configuration (Config.api)Version.java- SDK version
// Module-level API (uses default client)
Map<String, Object> output = Wavespeed.run("model", input);
String url = Wavespeed.upload("/path/to/file");
// Client instance
Client client = new Client("api-key");
Map<String, Object> output = client.run("model", input);
// Access global config
Wavespeed.config().maxRetries = 3;- Sync Mode: Single request that waits for result (
enableSyncMode) - Retry Logic: Configurable task-level and connection-level retries
- Timeout Control: Per-request and overall timeouts
- File Upload: Direct file upload to WaveSpeed storage
Global configuration via Config.api:
apiKey- WaveSpeed API keybaseUrl- API base URL (default: https://api.wavespeed.ai)connectionTimeout- Connection timeout in seconds (default: 10.0)timeout- Total API call timeout in seconds (default: 36000.0)maxRetries- Task-level retries (default: 0)maxConnectionRetries- HTTP connection retries (default: 5)retryInterval- Base retry delay in seconds (default: 1.0)
Client-level configuration via constructor:
Client client = new Client(
apiKey,
baseUrl,
connectionTimeout,
maxRetries,
maxConnectionRetries,
retryInterval
);WAVESPEED_API_KEY- API keyWAVESPEED_BASE_URL- Base URL (default: https://api.wavespeed.ai)WAVESPEED_CONNECTION_TIMEOUT- Connection timeout (default: 10.0)WAVESPEED_TIMEOUT- Total timeout (default: 36000.0)WAVESPEED_MAX_RETRIES- Task-level retries (default: 0)WAVESPEED_MAX_CONNECTION_RETRIES- HTTP retries (default: 5)WAVESPEED_RETRY_INTERVAL- Retry interval (default: 1.0)
src/main/java/ai/wavespeed/
├── Wavespeed.java # Module-level API
├── Version.java # SDK version
├── Config.java # Global configuration
└── api/
├── Client.java # Main client implementation
└── package-info.java # Package documentation
src/test/java/ai/wavespeed/
└── (test files)
pom.xml # Maven configuration
Key dependencies (see pom.xml):
- OkHttp 4.12.0 - HTTP client
- Gson 2.10.1 - JSON serialization
- JUnit 5 - Testing framework
This project uses Maven for versioning and GitHub Actions for releases. See VERSIONING.md for details.
To create a release:
- Update version in
pom.xml - Commit and tag:
git tag v0.1.0 - Push:
git push origin v0.1.0 - GitHub Actions will publish to Maven Central
This project uses:
- Standard Java naming conventions (camelCase for methods, PascalCase for classes)
- No Lombok (plain Java)
- System.out for logging (simple approach)
- Direct field access for Config.api (public fields)