npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

devquarks-image-sdk

v1.0.2

Published

SDK for generating high-quality images via Devquarks API at 10x cheaper cost

Readme

Devquarks Image SDK

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.

Features

  • 🚀 Ultra-fast image generation
  • 💰 10x cheaper than competitors
  • 🎨 High-quality AI-generated images
  • 📦 Simple and lightweight SDK
  • 🔒 Secure API authentication
  • 📱 Works with any Node.js application

Installation

npm install devquarks-image-sdk

Quick Start

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

API Reference

generateImage(options)

Generates an AI image based on the provided prompt.

Parameters

  • options (Object): Configuration object
    • token (string): Your Devquarks API token
    • prompt (string): Text description of the image you want to generate

Returns

  • Promise<Buffer>: A Promise that resolves to a Buffer containing the generated image data

Example

const imageBuffer = await generateImage({
  token: 'your-api-token',
  prompt: 'A futuristic city with flying cars'
});

Usage Examples

Basic Usage

import { generateImage } from 'devquarks-image-sdk';

const imageBuffer = await generateImage({
  token: 'your-api-token',
  prompt: 'A serene lake with mountains in the background'
});

Saving to File

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

Using with Express.js

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

Converting to Base64

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

Getting Your API Token

  1. Visit Devquarks Dashboard
  2. Sign up for an account or log in
  3. Navigate to API Keys section
  4. Generate a new API token
  5. Copy and use the token in your application

Error Handling

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
}

Common Error Scenarios

  • Invalid API Token: Check your token is correct and active
  • Network Issues: Ensure stable internet connection
  • Invalid Prompt: Make sure your prompt is descriptive and appropriate
  • Rate Limiting: Implement proper rate limiting in your application

Best Practices

  1. Environment Variables: Store your API token in environment variables

    const token = process.env.DEVQUARKS_API_TOKEN;
  2. Error Handling: Always implement proper error handling

    try {
      const imageBuffer = await generateImage({ token, prompt });
    } catch (error) {
      // Handle error appropriately
    }
  3. 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";

TypeScript Support

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

Requirements

  • Node.js 14.0 or higher
  • Active Devquarks API token

License

MIT License - see LICENSE file for details

Support


Made with ❤️ by Devquarks