veida

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 9 Imported by: 0

README

veida-go

Generate AI images from Go with no API key, no account and no card.

go get github.com/hanshs474/veida-go
url, err := veida.Generate(context.Background(),
    "a paper boat on a calm lake at sunrise, soft light",
    veida.Options{AspectRatio: "16:9"})
// https://cdn.veida.ai/uploads/kie/image/....webp

Or as a command-line tool:

go install github.com/hanshs474/veida-go/cmd/veida@latest
veida -ratio 16:9 "an isometric coffee shop, pastel palette"

The veida binary is also on Docker Hub and Chocolatey. It exits 3 when the free allowance is spent and 4 when the content filter refuses the prompt.

Every other image client wants a key from OpenAI, fal or Replicate before it runs once. This one talks to the anonymous tier of Veida — a client id the package invents rather than an account you register — so it works on a machine with nothing configured.

What you get

  • Zero dependencies. Standard library only, so there is nothing to pin and nothing that can drift out from under you.
  • A url, not bytes. The returned CDN link is permanent and cacheable.
  • Errors you can branch on. ErrQuota and ErrRejected are sentinel errors; errors.Is tells you whether to wait, to reword, or to sign in.
  • Context aware. Generate respects cancellation and carries its own deadline.

Limits, read out of the running service

  • The anonymous grant is 4 credits and one image costs 4, so the package mints a fresh client id per call. A loop is not limited to one image.
  • A ceiling of 30 credits per IP per day sits on top: roughly seven images a day from one machine. That surfaces as ErrQuota.
  • Free output is 1K and watermarked.
  • 🔴 Editing an existing image cannot run anonymously. That model costs 30 credits against a 4-credit grant, so an anonymous edit can never be paid for — this package does not pretend to offer one. Sign in and use the image editor or the ChatGPT image editor.
  • There is no video on this service.

Signing in removes the watermark, lifts the ceiling and opens the rest of the shelf: GPT Image 2 when the picture must contain readable text, Nano Banana 2 for instruction following, Seedream 5.0 Lite for colour and composition, and Qwen Image 3 for typography. Pricing lists what each tier costs.

Writing prompts that work

Name the light, the material and the composition. "A product photo of a mug" gives the model nothing; "matte black ceramic mug on pale oak, soft window light from the left, shallow depth of field" gives it a picture. Worked examples are in the prompt library, and finished output is in the showcase.

The same engine backs the ChatGPT image generator and the free AI image generator in a browser. There is also an MCP server and a Python package for the same endpoints.

Testing

go test ./...

The tests do not hit the network: they cover argument validation, per-call client id uniqueness and deadline propagation.

MIT.

Documentation

Overview

Package veida generates images from a text prompt with no API key and no account.

It calls the anonymous tier of veida.ai, which meters its free allowance against a client id this package invents rather than an account you register, so a program using it works on a machine with nothing configured.

url, err := veida.Generate(context.Background(), "a paper boat at sunrise", veida.Options{AspectRatio: "16:9"})

Measured against the running service: the anonymous grant is 4 credits and one image costs 4, so a fresh client id is minted per call. A ceiling of 30 credits per IP per day sits on top, which is roughly seven images from one machine. Free output is 1K and watermarked. Editing an existing image is not possible anonymously (that model costs more than the grant can pay), so this package deliberately offers generation only.

Index

Constants

View Source
const (
	AnonGrant       = 4  // credits a signed-out caller starts with
	CostTextToImage = 4  // credits one image costs
	IPDailyCeiling  = 30 // credits per IP per day, about seven images
)

Free-tier facts, read out of the running service rather than estimated.

View Source
const BaseURL = "https://veida.ai"

BaseURL is the service this package talks to.

Variables

View Source
var ErrQuota = errors.New("veida: free allowance spent")

ErrQuota is returned when the free allowance is spent. Signing in at https://veida.ai lifts the ceiling and removes the watermark.

View Source
var ErrRejected = errors.New("veida: prompt refused by the content filter")

ErrRejected is returned when the content filter refuses a prompt. Rewriting the prompt clears it; retrying the same text does not.

Functions

func Generate

func Generate(ctx context.Context, prompt string, opts Options) (string, error)

Generate turns prompt into an image and returns its permanent CDN url.

Naming the light, the material and the composition moves the result far more than adding adjectives.

Types

type Options

type Options struct {
	// AspectRatio is one of "1:1", "16:9", "9:16", "4:3", "3:4". Empty means "1:1".
	AspectRatio string
	// PollEvery is how often the job is polled. Zero means four seconds.
	PollEvery time.Duration
	// Timeout bounds the whole call. Zero means four minutes.
	Timeout time.Duration
	// HTTPClient is used for every request. Nil means http.DefaultClient.
	HTTPClient *http.Client
}

Options tunes a single generation. The zero value is valid and means a square image with a four minute deadline.

Directories

Path Synopsis
cmd
veida command
Command veida generates an image from a prompt and prints its url.
Command veida generates an image from a prompt and prints its url.
Command example generates one image and prints its url.
Command example generates one image and prints its url.

Jump to

Keyboard shortcuts

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