vectali

package module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Vectali

Vectali Go SDK

Official Go client for converting raster artwork to clean SVG, PDF, EPS, and DXF vectors. Requires Go 1.23+ and uses only the standard library.

Documentation · Code Examples · API Keys · Pricing

Install

go get github.com/vectali/vectali-go@v0.4.1

Every Vectali account includes 3 free hosted API trial conversions so you can test end-to-end before choosing a plan.

Quickstart

package main

import (
	"context"
	"log"
	"os"

	"github.com/vectali/vectali-go"
)

func main() {
	ctx := context.Background()
	client := vectali.NewClient(os.Getenv("VECTALI_API_KEY"))
	result, err := client.Convert(ctx, "logo.png")
	if err != nil {
		log.Fatal(err)
	}
	if err := os.WriteFile("logo.svg", []byte(result.Svg), 0644); err != nil {
		log.Fatal(err)
	}
	pdf, err := client.Download(ctx, result.ConversionID, "pdf")
	if err != nil {
		log.Fatal(err)
	}
	if err := os.WriteFile("logo.pdf", pdf, 0644); err != nil {
		log.Fatal(err)
	}
}

Key Methods

  • client.Convert(ctx, input, opts...) accepts a file path, []byte, or io.Reader (with optional ConvertOptions{Filename, IdempotencyKey}). Readers remain open.
  • client.Download(ctx, conversionID, format) returns raw []byte in memory ("svg", "pdf", "eps", "dxf"). Uploads stream from the supplied reader.
  • client.GetAllowance(ctx) and client.Health(ctx) inspect account credits and public API health.
  • Configure vectali.WithBaseURL(...) and vectali.WithTimeout(...) on NewClient. Failures return ResponseError with the HTTP response preserved.

Limits & Billing

Limit Value
Input formats PNG, JPG, GIF, BMP, WebP
Output formats SVG, PDF, EPS, DXF
Max file size 10 MiB
Max resolution 4,000,000 pixels (4096 px max per side)
Billing 3 free hosted trial conversions included; 1 credit per successful conversion, downloads are free
  • Idempotent retries: Every conversion accepts an Idempotency-Key (auto-generated UUID v4 if omitted). Reuse the same key and image bytes after an uncertain network error to avoid double-charging.
  • No automatic retries: Failed requests raise a structured error with HTTP status, X-Vectali-Request-Id, and Retry-After.
  • Server-side only: Keep VECTALI_API_KEY in server environment variables, never in browser code, prompts, or Git.
  • Safe transport defaults: 260-second timeout, redirects disabled, and cookies ignored.

Apache-2.0 · Source & tests in vectali/api-tooling (v0.4.1).

Documentation

Overview

Code generated by the Vectali tooling. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingSummary

type BillingSummary = forge.BillingSummary

type Client added in v0.3.0

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.3.0

func NewClient(apiKey string, options ...ClientOption) *Client

func (*Client) Convert added in v0.3.0

func (c *Client) Convert(ctx context.Context, image any, options ...ConvertOptions) (*Conversion, error)

Convert accepts []byte, an io.Reader, or a filesystem path string.

func (*Client) ConvertImage added in v0.3.0

func (c *Client) ConvertImage(ctx context.Context, image any, options ...ConvertOptions) (*Conversion, error)

func (*Client) Download added in v0.3.0

func (c *Client) Download(ctx context.Context, id, format string) ([]byte, error)

func (*Client) GetAllowance added in v0.3.0

func (c *Client) GetAllowance(ctx context.Context) (*BillingSummary, error)

func (*Client) GetVector added in v0.3.0

func (c *Client) GetVector(ctx context.Context, id, format string) ([]byte, error)

func (*Client) Health added in v0.3.0

func (c *Client) Health(ctx context.Context) (*Health, error)

type ClientOption added in v0.3.0

type ClientOption = forge.Option

func WithBaseURL added in v0.3.0

func WithBaseURL(origin string) ClientOption

func WithTimeout added in v0.3.0

func WithTimeout(timeout time.Duration) ClientOption

type Conversion

type Conversion = forge.Conversion

type ConvertOptions added in v0.3.0

type ConvertOptions struct {
	Filename       string
	IdempotencyKey string
}

type Health added in v0.4.0

type Health = forge.HealthStatus200

type ResponseError added in v0.3.0

type ResponseError struct {
	Response *http.Response
	Err      error
}

ResponseError retains the HTTP diagnostics. Unwrap exposes the Forge error.

func (*ResponseError) Error added in v0.3.0

func (e *ResponseError) Error() string

func (*ResponseError) Unwrap added in v0.3.0

func (e *ResponseError) Unwrap() error

Directories

Path Synopsis
internal
Local transport contract test.
Local transport contract test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL