Skip to main content

Official Python SDK for the VectoSolve API — AI-powered image vectorization, background removal, upscaling, and SVG generation.

Project description

VectoSolve Python SDK

Official Python client for the VectoSolve API — AI-powered image vectorization, background removal, upscaling, and SVG generation.

PyPI Python License: MIT

Installation

pip install vectosolve

Quick Start

from vectosolve import VectoSolve

client = VectoSolve(api_key="vs_your_api_key")

# Convert an image to SVG
result = client.vectorize("photo.png")
result.save("output.svg")
print(f"Credits remaining: {result.credits.remaining}")

Get your API key at vectosolve.com/dashboard.

Features

Method Description Cost
vectorize() Convert raster images (PNG, JPG, WebP) to clean SVG $0.20
remove_background() Remove image backgrounds with AI $0.07
upscale() AI-powered image upscaling (2x/4x) $0.15
generate_svg() Generate SVGs from text prompts $0.25
generate_logo() AI logo generation with multiple variants $0.25-$0.40
generate_pattern() Generate seamless tileable patterns $0.25
batch() Process up to 10 images in a single request varies

Usage

Vectorize (Image to SVG)

# From a local file
result = client.vectorize("photo.png")
result.save("output.svg")

# From a URL
result = client.vectorize("https://example.com/image.png")
print(result.svg)  # Raw SVG string

Remove Background

result = client.remove_background("product.jpg")
print(result.image_url)  # URL of the processed image

Upscale

result = client.upscale("small-image.png")
print(result.image_url)

Generate SVG from Text

result = client.generate_svg(
    "a golden retriever playing fetch in a park",
    style="vector_illustration",
    size="1024x1024",
    colors=["#f4a460", "#228b22", "#87ceeb"],
)
result.save("dog.svg")

Available styles: vector_illustration, vector_illustration/line_art, vector_illustration/engraving, vector_illustration/linocut, vector_illustration/bold_stroke, vector_illustration/colored_stencil, vector_illustration/thin, vector_illustration/mosaic, vector_illustration/flat_2

Available sizes: 1024x1024, 1024x1536, 1536x1024

Generate Logo

result = client.generate_logo(
    "minimalist coffee shop logo with a steaming cup",
    model="v3",
    num_variants=4,
    colors=["#6f4e37", "#f5f5dc"],
)

for i, logo in enumerate(result.logos):
    logo.save(f"logo_{i}.svg")

Generate Pattern

result = client.generate_pattern(
    "tropical leaves and flowers",
    colors=["#2d5016", "#ff6b6b", "#ffd93d"],
)
print(result.image_url)

Batch Processing

result = client.batch([
    {"url": "https://example.com/photo1.png", "operation": "vectorize"},
    {"url": "https://example.com/photo2.jpg", "operation": "remove_bg"},
    {"url": "https://example.com/photo3.png", "operation": "upscale"},
])

for item in result.results:
    if item.success:
        print(f"[{item.index}] {item.operation}: {item.url}")
    else:
        print(f"[{item.index}] Failed: {item.error}")

print(f"Processed: {result.total_processed}, Failed: {result.total_failed}")

Environment Variable

Instead of passing the API key directly, you can set it as an environment variable:

export VECTOSOLVE_API_KEY="vs_your_api_key"
client = VectoSolve()  # Automatically reads VECTOSOLVE_API_KEY

Error Handling

from vectosolve import (
    VectoSolve,
    AuthenticationError,
    InsufficientCreditsError,
    RateLimitError,
    ValidationError,
)

client = VectoSolve(api_key="vs_your_api_key")

try:
    result = client.vectorize("image.png")
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError as e:
    print(f"Need {e.required} credits — top up at vectosolve.com/pricing")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except ValidationError as e:
    print(f"Bad request: {e.message}")

Context Manager

with VectoSolve(api_key="vs_your_api_key") as client:
    result = client.vectorize("photo.png")
    result.save("output.svg")
# Connection automatically closed

Use Cases

  • Cricut & Silhouette — Convert designs to cut-ready SVGs
  • Laser cutting — Vectorize artwork for laser engravers
  • Embroidery — Convert images for embroidery machines
  • E-commerce — Remove backgrounds from product photos
  • Design automation — Generate logos and patterns programmatically

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vectosolve-1.0.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vectosolve-1.0.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file vectosolve-1.0.0.tar.gz.

File metadata

  • Download URL: vectosolve-1.0.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for vectosolve-1.0.0.tar.gz
Algorithm Hash digest
SHA256 626c00abf3569d28898b729a707ee1826908934568a9d0ab27a157765d892c34
MD5 e48c9391de369873440cc2cf5448b75d
BLAKE2b-256 28ca1fb6e75e154d3d6d0bab8194fcdbce23beff68ad80a0ff83f6d6e69a1312

See more details on using hashes here.

File details

Details for the file vectosolve-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vectosolve-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for vectosolve-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08eea97e3dbb66c6b912ff40fc9cdef2d67d09e1810fcd63f83aea76688d90ed
MD5 7daeb40b87298af89e4e8c8f38d618a6
BLAKE2b-256 ef3d6d5b22e38ca934ff8699f0d8418d4f5518e98eb154c8efa2ee281cf00d74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page