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 ¶
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.
const BaseURL = "https://veida.ai"
BaseURL is the service this package talks to.
Variables ¶
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.
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 ¶
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.