Skip to main content

Crate veida

Crate veida 

Source
Expand description

Generate images from Rust with no API key and no account.

This crate calls the anonymous tier of Veida, which meters its free allowance against a client id the crate invents rather than an account you register, so a program using it runs on a machine with nothing configured.

let img = veida::generate("a paper boat at sunrise", &veida::Options::default())?;
println!("{}", img.url);

Measured against the running service: a signed-out caller is granted 4 credits and one image costs 4, so the crate mints a fresh client id per call. A ceiling of 30 credits per IP per day sits above that, roughly seven images from one machine. Free output is 1K and watermarked.

Structs§

Image
One finished picture.
Options
Tunes a single call. Options::default() is a square image with a four minute deadline.

Enums§

Error
Everything that can go wrong, split by what the caller should do next.

Constants§

ANON_GRANT
Credit balance a signed-out caller starts with.
ASPECT_RATIOS
Aspect ratios the free engine accepts.
BASE_URL
The service this crate talks to.
COST_TEXT_TO_IMAGE
What one generated image costs, so the grant pays for exactly one.
IP_DAILY_CEILING
Credits one machine may spend per day regardless of client ids.
MODEL
The free text-to-image engine.

Functions§

anon_id
A fresh client id. The grant pays for one image, so a reused id walls on the second call of a loop.
generate
Turn a prompt into an image.
parse_poll
Interpret one poll. Status is not monotonic (pending and processing alternate), so only a terminal failure ends the wait early.
parse_submit
Interpret the submit response. The quota wall answers HTTP 200 with code 0, so it can only be recognised by a field.