
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
devquarks-image-sdk
Advanced tools
SDK for generating high-quality images via Devquarks API at 10x cheaper cost
Generate high-quality AI images in your apps/websites at 10x cheaper cost using Devquarks API. This SDK provides a simple interface to integrate AI image generation into your Node.js applications.
npm install devquarks-image-sdk
import { generateImage } from 'devquarks-image-sdk';
import fs from 'fs';
async function createImage() {
try {
const imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A beautiful sunset over mountains'
});
// Save the image to file
fs.writeFileSync('generated-image.png', imageBuffer);
console.log('Image generated successfully!');
} catch (error) {
console.error('Error generating image:', error.message);
}
}
createImage();
generateImage(options)Generates an AI image based on the provided prompt.
options (Object): Configuration object
token (string): Your Devquarks API tokenprompt (string): Text description of the image you want to generatePromise<Buffer>: A Promise that resolves to a Buffer containing the generated image dataconst imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A futuristic city with flying cars'
});
import { generateImage } from 'devquarks-image-sdk';
const imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A serene lake with mountains in the background'
});
import { generateImage } from 'devquarks-image-sdk';
import fs from 'fs';
async function saveImage() {
const imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A magical forest with glowing mushrooms'
});
fs.writeFileSync('magical-forest.png', imageBuffer);
}
import express from 'express';
import { generateImage } from 'devquarks-image-sdk';
const app = express();
app.use(express.json());
app.post('/generate-image', async (req, res) => {
try {
const { prompt } = req.body;
const imageBuffer = await generateImage({
token: process.env.DEVQUARKS_API_TOKEN,
prompt
});
res.set('Content-Type', 'image/png');
res.send(imageBuffer);
} catch (error) {
res.status(500).json({ error: error.message });
}
});
import { generateImage } from 'devquarks-image-sdk';
async function getBase64Image() {
const imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A cyberpunk cityscape at night'
});
const base64Image = imageBuffer.toString('base64');
console.log(`data:image/png;base64,${base64Image}`);
}
The SDK throws errors for various scenarios. Always wrap your calls in try-catch blocks:
try {
const imageBuffer = await generateImage({
token: 'your-api-token',
prompt: 'A beautiful landscape'
});
} catch (error) {
console.error('Failed to generate image:', error.message);
// Handle the error appropriately
}
Environment Variables: Store your API token in environment variables
const token = process.env.DEVQUARKS_API_TOKEN;
Error Handling: Always implement proper error handling
try {
const imageBuffer = await generateImage({ token, prompt });
} catch (error) {
// Handle error appropriately
}
Prompt Quality: Use descriptive and specific prompts for better results
// Good prompt
const prompt = "A detailed oil painting of a red rose on a wooden table with soft lighting";
// Better than generic prompt
const prompt = "flower";
This SDK is written in TypeScript and includes type definitions:
import { generateImage, ImageGenOptions } from 'devquarks-image-sdk';
const options: ImageGenOptions = {
token: 'your-api-token',
prompt: 'A majestic eagle soaring through clouds'
};
const imageBuffer: Buffer = await generateImage(options);
MIT License - see LICENSE file for details
Made with ❤️ by Devquarks
FAQs
SDK for generating high-quality images via Devquarks API at 10x cheaper cost
We found that devquarks-image-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.