Expand description
Generate and edit images from Rust with no API key and no account.
This crate calls the anonymous tier of Kavel, 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 = kavel::generate("a paper boat at sunrise", &kavel::Options::default())?;
println!("{}", img.url);Measured against the running service: a signed-out caller is granted 15 credits, one generated image costs 5 and one edit costs 15, so the crate mints a fresh client id per call. A ceiling of 30 credits per IP per day sits above that. Free output is 1K and watermarked.
Structs§
- Image
- One finished picture.
- Options
- Tunes a single call.
Options::default()is a square image with a six 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.
- BASE_
URL - The service this crate talks to.
- COST_
EDIT - What one edit costs: the whole grant, so one edit per client id.
- COST_
TEXT_ TO_ IMAGE - What one generated image costs, so the grant pays for three.
- IP_
DAILY_ CEILING - Credits one machine may spend per day regardless of client ids.
- MODEL_
EDIT - The free image-to-image engine.
- MODEL_
GENERATE - The free text-to-image engine.
Functions§
- anon_id
- A fresh client id. The grant pays for three images or one edit, so a reused id walls partway through a loop for reasons the caller cannot see.
- credits
- What a client id has left. Costs nothing to call.
Noneasks about a fresh id. - edit
- Rewrite an existing image.
source_urlmust be a public http(s) url andinstructionsays what to change. - generate
- Turn a prompt into a new image.
- parse_
submit - Interpret the submit response. The quota wall answers HTTP 200 with code 0, so it can only be recognised by a field.