Generate images from Clojure with no API key, no account and no card.
(require '[veida.core :as veida])
(veida/generate "a paper boat on a calm lake at sunrise, soft light" {:aspect-ratio "16:9"})
;; => {:url "https://cdn.veida.ai/uploads/....webp" :watermarked? true}
Install:
;; deps.edn
io.github.hanshs474/veida-clj {:mvn/version "0.1.0"}
;; Leiningen
[io.github.hanshs474/veida-clj "0.1.0"]
Most image libraries want a key from OpenAI, fal or Replicate before they run once. This one talks to the anonymous tier of Veida, an online AI image generator, using a client id the library invents rather than an account you register, so it works on a fresh machine with nothing configured.
Measured against the running service:
| Anonymous grant per client id | 4 credits |
| One text-to-image run | 4 credits, so one image per id |
| Per-IP ceiling | 30 credits a day, roughly 7 images |
| Output | 1K, watermarked |
The library mints a fresh client id for every call, so a loop is not limited to one image;
the per-IP ceiling is what stops it. When that is spent you get an ex-info with :reason :quota saying so.
Editing an existing photo is not offered here. The editing model costs 30 credits against a 4-credit grant, so an anonymous edit could never be paid for. Signed in, the image editor does that in a browser.
Signing in removes the watermark, lifts the cap and opens the larger models: GPT Image 2 when the picture must contain readable text, Nano Banana 2 for instruction following and Seedream 5.0 Lite for colour and composition. What each costs is on the pricing page.
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 live in the prompt library. The same engine backs the ChatGPT image generator and the free AI image generator in a browser.
(veida/generate prompt)
(veida/generate prompt {:aspect-ratio "16:9" :timeout-ms 240000 :poll-ms 4000 :http-client hc})
;; failures: (ex-data e) => {:reason :quota | :rejected | :timeout | :other}
Aspect ratio is one of 1:1, 16:9, 9:16, 4:3, 3:4.
A thin wrapper over the zero-dependency Java client io.github.hanshs474/veida on Maven Central.
Other clients: Python · Go · MCP server.
MIT.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |