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

rendercad-ai

v0.1.0

Published

Node.js client library for the RenderCAD AI API - Transform flat images into photorealistic renders

Readme

RenderCAD AI - Node.js Client

A Node.js client library for the RenderCAD AI API. Transform flat images into photorealistic renders via a simple API.

Installation

npm install rendercad-ai

For Node.js versions below 18, you'll need to install node-fetch:

npm install rendercad-ai node-fetch

Quick Start

const RenderCADClient = require('rendercad-ai');

// Initialize client with your API token
const client = new RenderCADClient('YOUR_API_TOKEN');

// Render an image
const result = await client.renderImage('./image.jpg');
console.log('Job ID:', result.job_id);

// Check status
const status = await client.checkStatus(result.job_id);
console.log('Status:', status.status);
if (status.status === 'completed') {
  console.log('Output URL:', status.output_url);
}

Authentication

Method 1: API Token (Recommended)

Get your API token from: Account Settings → API Tokens → Generate New Token

const client = new RenderCADClient('YOUR_API_TOKEN');

Method 2: Device Code Flow

For desktop apps, browser extensions, and CLI tools:

const client = new RenderCADClient();

// Step 1: Request device code
const deviceCode = await client.requestDeviceCode({
  app_name: 'My Desktop App',
  app_type: 'desktop-app',
  app_version: '1.0.0'
});

console.log('Code:', deviceCode.code);
console.log('Visit:', deviceCode.verification_url);

// Step 2: Poll for authorization
const checkAuth = async () => {
  const result = await client.pollDeviceCode(deviceCode.code);
  
  if (result.status === 'authorized') {
    client.setApiToken(result.api_token);
    console.log('Authorized!');
  } else {
    // Wait and poll again
    setTimeout(checkAuth, deviceCode.poll_interval * 1000);
  }
};

checkAuth();

API Reference

Constructor

new RenderCADClient(apiToken, options)
  • apiToken (string, optional): Your API token
  • options (object, optional):
    • baseUrl (string): Base URL for the API (default: 'https://rendercad.ai')

Methods

renderImage(image)

Submit an image for rendering.

Parameters:

  • image (Buffer | string): Image buffer, file path, or base64 data URL

Returns: Promise resolving to { success: true, job_id: string }

Example:

// Using file path
const result = await client.renderImage('./image.jpg');

// Using Buffer
const fs = require('fs');
const buffer = fs.readFileSync('image.jpg');
const result = await client.renderImage(buffer);

// Using base64 string
const result = await client.renderImage('data:image/jpeg;base64,/9j/4AAQ...');

checkStatus(jobId)

Check the status of a render job.

Parameters:

  • jobId (string): Job ID from renderImage response

Returns: Promise resolving to:

{
  success: true,
  status: 'pending' | 'processing' | 'completed' | 'failed',
  output_url?: string  // Present when status is 'completed'
}

Example:

const status = await client.checkStatus('render_68f59c4d873762.99760761');

checkAccount()

Get account information and usage statistics.

Returns: Promise resolving to:

{
  success: true,
  user: {
    monthly_render_limit: number,
    monthly_renders_used: number
  }
}

Example:

const account = await client.checkAccount();
console.log(`Used ${account.user.monthly_renders_used} of ${account.user.monthly_render_limit} renders`);

requestDeviceCode(options)

Request a device code for OAuth-style authentication.

Parameters:

  • options (object, optional):
    • app_name (string): Application name
    • app_type (string): 'browser-extension', 'desktop-app', 'mobile-app', or 'cli-tool'
    • app_version (string): Application version

Returns: Promise resolving to:

{
  success: true,
  code: string,
  expires_in: number,
  poll_interval: number,
  verification_url: string
}

pollDeviceCode(code)

Poll for device code authorization.

Parameters:

  • code (string): Device code from requestDeviceCode

Returns: Promise resolving to:

{
  status: 'pending' | 'authorized',
  api_token?: string  // Present when status is 'authorized'
}

setApiToken(token)

Set or update the API token.

Parameters:

  • token (string): API token

Error Handling

The client throws custom error classes for different HTTP status codes:

const {
  RenderCADError,
  BadRequestError,      // 400
  UnauthorizedError,   // 401
  NotFoundError,       // 404
  RateLimitError,      // 429
  ServerError,         // 500
} = require('rendercad-ai/src/errors');

try {
  await client.renderImage('./image.jpg');
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log('Monthly limit exceeded');
  } else if (error instanceof UnauthorizedError) {
    console.log('Invalid API token');
  } else {
    console.log('Error:', error.message);
  }
}

Complete Example

const RenderCADClient = require('rendercad-ai');
const fs = require('fs');

async function renderExample() {
  const client = new RenderCADClient('YOUR_API_TOKEN');

  try {
    // Check account
    const account = await client.checkAccount();
    console.log(`Account: ${account.user.monthly_renders_used}/${account.user.monthly_render_limit} renders used`);

    // Render image
    const result = await client.renderImage('./input.jpg');
    console.log('Job ID:', result.job_id);

    // Poll for completion
    let status;
    do {
      await new Promise(resolve => setTimeout(resolve, 3000)); // Wait 3 seconds
      status = await client.checkStatus(result.job_id);
      console.log('Status:', status.status);
    } while (status.status === 'pending' || status.status === 'processing');

    if (status.status === 'completed') {
      console.log('Render complete! Output URL:', status.output_url);
    } else {
      console.log('Render failed');
    }
  } catch (error) {
    console.error('Error:', error.message);
  }
}

renderExample();

Image Requirements

  • Formats: JPEG, PNG, GIF, WebP
  • Max size: 10MB
  • Encoding: Automatically handled by the client (base64 with data URL prefix)

Rate Limits

  • Monthly token limits based on your plan
  • Each render consumes 1 token
  • API blocked when token limit exceeded
  • Usage resets monthly

License

MIT