
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
A JavaScript/TypeScript client for the WaveSpeed AI image generation API. This client is compatible with both JavaScript and TypeScript projects.
npm install wavespeed
const { WaveSpeed } = require('wavespeed');
// Initialize the client with your API key
const client = new WaveSpeed('YOUR_API_KEY');
// Generate an image and wait for the result
async function generateImage() {
const prediction = await client.run(
'wavespeed-ai/flux-dev',
{
prompt: 'A futuristic cityscape with flying cars and neon lights',
size: '1024*1024',
num_inference_steps: 28,
guidance_scale: 5.0,
num_images: 1,
seed: -1,
enable_safety_checker: true
}
);
// Print the generated image URLs
prediction.outputs.forEach((imgUrl, i) => {
console.log(`Image ${i+1}: ${imgUrl}`);
});
}
generateImage().catch(console.error);
import WaveSpeed from 'wavespeed';
// Initialize the client with your API key
const client = new WaveSpeed('YOUR_API_KEY');
// Generate an image and wait for the result
async function generateImage(): Promise<void> {
const input: Record<string, any> = {
prompt: 'A futuristic cityscape with flying cars and neon lights',
size: '1024*1024',
num_inference_steps: 28,
guidance_scale: 5.0,
num_images: 1,
seed: -1,
enable_safety_checker: true
};
const prediction = await client.run('wavespeed-ai/flux-dev', input);
// Print the generated image URLs
prediction.outputs.forEach((imgUrl, i) => {
console.log(`Image ${i+1}: ${imgUrl}`);
});
}
generateImage().catch(console.error);
If you need more control over the polling process, you can use the create method and manually poll for status updates:
import WaveSpeed from 'wavespeed';
// Initialize the client with your API key
const client = new WaveSpeed('YOUR_API_KEY');
async function generateWithManualPolling(): Promise<void> {
// Create a prediction without waiting
const prediction = await client.create('wavespeed-ai/flux-dev', {
prompt: 'A beautiful mountain landscape at sunset',
size: '1024*1024',
num_inference_steps: 28,
guidance_scale: 5.0,
num_images: 1
});
console.log(`Prediction created with ID: ${prediction.id}`);
console.log(`Initial status: ${prediction.status}`);
// Manually poll for status updates
let currentPrediction = prediction;
while (currentPrediction.status !== 'completed' && currentPrediction.status !== 'failed') {
console.log('Prediction still processing, checking again in 2 seconds...');
await new Promise(resolve => setTimeout(resolve, 2000));
// Reload the prediction to get the latest status
currentPrediction = await currentPrediction.reload();
console.log(`Updated status: ${currentPrediction.status}`);
}
if (currentPrediction.status === 'completed') {
console.log('Prediction completed successfully!');
currentPrediction.outputs.forEach((imgUrl, i) => {
console.log(`Image ${i+1}: ${imgUrl}`);
});
} else {
console.error(`Prediction failed: ${currentPrediction.error}`);
}
}
generateWithManualPolling().catch(console.error);
new WaveSpeed(apiKey?: string, options?: {
baseUrl?: string,
pollInterval?: number,
timeout?: number
})
apiKey (string): Your WaveSpeed API keyoptions (object, optional):
baseUrl (string): API base URL (default: 'https://api.wavespeed.ai/api/v2/')pollInterval (number): Interval in seconds for polling prediction status (default: 1)timeout (number): Timeout in seconds for API requests (default: 60)run(modelId: string, input: Record<string, any>, options?: RequestOptions): Promise<Prediction>
Generate an image and wait for the result.
create(modelId: string, input: Record<string, any>, options?: RequestOptions): Promise<Prediction>
Create a prediction without waiting for it to complete.
The Prediction object contains information about an image generation job:
prediction.id // Unique ID of the prediction
prediction.model // Model ID used for the prediction
prediction.status // Status of the prediction (processing, completed, failed)
prediction.input // Input parameters used for the prediction
prediction.outputs // List of output image URLs
prediction.urls.get // URL to get the prediction status
prediction.has_nsfw_contents // List of booleans indicating if each image has NSFW content
prediction.created_at // Creation timestamp
prediction.error // Error message (if any)
prediction.executionTime // Time taken to execute the prediction in milliseconds
prediction.wait(): Promise<Prediction> // Wait for the prediction to complete
prediction.reload(): Promise<Prediction> // Reload the prediction status
WAVESPEED_API_KEY: Your WaveSpeed API keyWAVESPEED_POLL_INTERVAL: Interval in seconds for polling prediction status (default: 1)WAVESPEED_TIMEOUT: Timeout in seconds for API requests (default: 60)MIT
FAQs
WaveSpeed Client SDK for Wavespeed API
The npm package wavespeed receives a total of 821 weekly downloads. As such, wavespeed popularity was classified as not popular.
We found that wavespeed demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.