Skip to content
Tutorial

VectoSolve TypeScript SDK: Integrate AI Image Vectorization in Your App

The official TypeScript SDK for VectoSolve gives you type-safe access to AI vectorization, background removal, upscaling, and logo generation. Install via npm, authenticate with your API key, and ship production integrations in minutes.

Robin MonteiroMarch 16, 20267 min read
Use this article with an AI assistant:
.md
VectoSolve TypeScript SDK: Integrate AI Image Vectorization in Your App
R
Robin Monteiro

Founder of VectoSolve

Self-taught developer, founder and sole developer of VectoSolve since 2024. He builds the conversion engine and the cutting, embroidery and 3D printing exports.

How this article was made: drafted with AI assistance, then edited and fact-checked before publication. About the author

Image vectorizationCutting machine filesEmbroidery filesSVG
Free previewNo signupFull-quality output

Try it on your own file

Free preview, no signup. Drop an image and see the vector before deciding anything.

Why Use the TypeScript SDK?

You can call the VectoSolve REST API with fetch or Axios, and it works fine. But raw HTTP calls mean writing boilerplate: constructing FormData, setting headers, parsing responses, handling errors, managing retries. The official TypeScript SDK eliminates all of that.

Here is what you get out of the box:

  • Full type safety — every method, option, and response is typed
  • Automatic authentication — pass your API key once, forget about headers
  • File handling — accepts file paths, Buffers, ReadableStreams, and URLs
  • Error classes — typed errors for insufficient credits, rate limits, invalid input
  • Retries with backoff — transient failures are retried automatically
  • Tree-shakable — only import what you use, zero bloat in your bundle

If you are building a Node.js backend, a Next.js app, or any TypeScript project that needs image processing, the SDK is the fastest path to production.

Installation

Install from npm:

bash
npm install @vectosolve/sdk

The package ships with TypeScript declarations included — no separate @types package needed. It supports Node.js 18+ and works with ESM and CommonJS.

Authentication

Every API call requires an API key. Create one at vectosolve.com/developers:

  1. Sign in or create an account
  2. Go to the API Keys section
  3. Click Create New Key and copy it immediately (it will not be shown again)
  4. Store it in an environment variable — never commit API keys to source control

Then initialize the client:

typescript
import { VectoSolve } from '@vectosolve/sdk';

const client = new VectoSolve({
  apiKey: process.env.VECTOSOLVE_API_KEY!,
});

Pro Tip: Store your API key in .env or your secrets manager. The SDK reads from the constructor argument, not from environment variables directly, so you stay in control of how secrets are loaded.

A Full Year of Conversions for $49

Starter Annual: 25 conversions every month, $49 for the whole year. That is about $4.08 a month · Cancel anytime

Get the Annual Deal

Vectorize an Image

The core feature: convert a raster image (PNG, JPG, WebP) into a clean, scalable SVG.

From a File Path

typescript
import { VectoSolve } from '@vectosolve/sdk';

const client = new VectoSolve({ apiKey: process.env.VECTOSOLVE_API_KEY! });

const result = await client.vectorize({
  file: './logo.png',
});

// result.svg — the SVG string
// result.creditsUsed — 0.20
// result.metadata — width, height, colors, pathCount
await fs.writeFile('logo.svg', result.svg);

From a URL

typescript
const result = await client.vectorize({
  url: 'https://example.com/image.png',
});

From a Buffer

typescript
const buffer = await fs.readFile('./input.png');

const result = await client.vectorize({
  buffer,
  filename: 'input.png',
});

This flexibility means the SDK fits into any pipeline — whether you are reading files from disk, fetching them from S3, or receiving uploads from users.

Remove Background

Strip the background from any image and get back a transparent PNG.

typescript
const result = await client.removeBackground({
  file: './product-photo.jpg',
});

// result.image — Buffer of the transparent PNG
// result.creditsUsed — 0.07
await fs.writeFile('product-no-bg.png', result.image);

At $0.07 per image, this is one of the most cost-effective background removal APIs available. It handles hair, fur, transparent objects, and complex edges.

Upscale

Increase image resolution by 2x or 4x using AI upscaling. Great for low-res logos or old graphics.

typescript
const result = await client.upscale({
  file: './small-icon.png',
  scale: 4, // 2 or 4
});

// result.image — Buffer of the upscaled image
// result.creditsUsed — 0.15
await fs.writeFile('icon-4x.png', result.image);

Free SVG Tools for Crafters

Design Checker · Color Separator · Mat Preview · Offset Generator · Text to SVG

Check Your SVG Free

Create an AI-generated logo from a text prompt, with control over style and colors.

typescript
const result = await client.generateLogo({
  prompt: 'A mountain peak with aurora borealis, minimalist geometric style',
  style: 'geometric', // geometric | hand-drawn | vintage | modern | playful
  colors: ['#1cb721', '#0090ff', '#ffffff'],
});

// result.svg — generated SVG logo
// result.creditsUsed — 0.25
await fs.writeFile('logo.svg', result.svg);

The style parameter guides the visual direction. The colors array constrains the palette — useful when you need to match brand guidelines.

Batch Processing

Process multiple images in parallel with concurrency control:

typescript
import { VectoSolve } from '@vectosolve/sdk';
import fs from 'fs/promises';
import path from 'path';

const client = new VectoSolve({ apiKey: process.env.VECTOSOLVE_API_KEY! });

const imageDir = './images';
const files = await fs.readdir(imageDir);
const pngFiles = files.filter(f => f.endsWith('.png'));

// Process 5 images at a time
const results = await client.batch(
  pngFiles.map(file => ({
    method: 'vectorize',
    params: { file: path.join(imageDir, file) },
  })),
  { concurrency: 5 }
);

for (const result of results) {
  if (result.status === 'fulfilled') {
    const outPath = result.input.replace('.png', '.svg');
    await fs.writeFile(outPath, result.value.svg);
    console.log(`Converted: ${outPath}`);
  } else {
    console.error(`Failed: ${result.input} — ${result.reason.message}`);
  }
}

The batch method uses Promise.allSettled internally, so one failure does not abort the entire batch. Each result tells you whether it succeeded or failed, and why.

Pricing

Every method costs a fixed amount of credits. No hidden fees, no per-pixel charges.

MethodCost per callWhat you get
vectorize()$0.20Clean SVG from any raster image
removeBackground()$0.07Transparent PNG, no background
upscale()$0.152x or 4x resolution increase
generateLogo()$0.25+AI-generated SVG logo from prompt

Credits never expire. API credits come in lots from $19.99 for 100 conversions — see the developer page.

A Full Year of Conversions for $49

Starter Annual: 25 conversions every month, $49 for the whole year. That is about $4.08 a month · Cancel anytime

Get the Annual Deal

Error Handling

The SDK throws typed errors so you can handle each case explicitly:

typescript
import { VectoSolve, InsufficientCreditsError, RateLimitError, VectoSolveError } from '@vectosolve/sdk';

const client = new VectoSolve({ apiKey: process.env.VECTOSOLVE_API_KEY! });

try {
  const result = await client.vectorize({ file: './image.png' });
  console.log('SVG length:', result.svg.length);
} catch (error) {
  if (error instanceof InsufficientCreditsError) {
    console.error('Out of credits. Buy more at vectosolve.com/pricing');
    console.error('Current balance:', error.balance);
  } else if (error instanceof RateLimitError) {
    console.error('Rate limited. Retry after:', error.retryAfter, 'seconds');
  } else if (error instanceof VectoSolveError) {
    console.error('API error:', error.message, 'Status:', error.status);
  } else {
    throw error; // unexpected error, re-throw
  }
}

Every error extends VectoSolveError, so you can catch all API errors with a single instanceof check if you prefer a simpler approach.

TypeScript Types

The SDK exports all types you need for building type-safe integrations:

typescript
import type {
  VectorizeOptions,
  VectorizeResult,
  RemoveBackgroundOptions,
  RemoveBackgroundResult,
  UpscaleOptions,
  UpscaleResult,
  GenerateLogoOptions,
  GenerateLogoResult,
  BatchItem,
  BatchResult,
  VectoSolveConfig,
} from '@vectosolve/sdk';

Key interfaces:

typescript
interface VectorizeOptions {
  file?: string;           // local file path
  url?: string;            // remote image URL
  buffer?: Buffer;         // raw image buffer
  filename?: string;       // required when using buffer
}

interface VectorizeResult {
  svg: string;             // the SVG markup
  creditsUsed: number;     // credits consumed
  metadata: {
    width: number;
    height: number;
    colors: number;
    pathCount: number;
    fileSizeBytes: number;
  };
}

interface VectoSolveConfig {
  apiKey: string;
  baseUrl?: string;        // default: https://vectosolve.com/api/v1
  timeout?: number;        // default: 60000 (ms)
  retries?: number;        // default: 2
}

These types work with any IDE that supports TypeScript — you get autocompletion, inline docs, and compile-time checks without reading documentation.

Next Steps

The TypeScript SDK is part of a growing developer ecosystem:

The SDK is open-source. Found a bug or want a feature? Open an issue on GitHub. We ship updates weekly and follow semver, so you can update without surprises.


Ready to integrate? Install the SDK and make your first API call in under 2 minutes:

bash
npm install @vectosolve/sdk

Visit vectosolve.com/developers to create your API key and start building.

Tags:
sdk
typescript
api
vectorize
npm
developer-tools
Share:

Try Vectosolve Now

Convert your images to high-quality SVG vectors with AI

AI-Powered Vectorization

Ready to vectorize your images?

Convert your PNG, JPG, and other images to high-quality, scalable SVG vectors in seconds.