### Install veida-go with go get Source: https://veida.readthedocs.io/en/latest/sdk/go Installs the veida-go package using the Go module system. Run this before importing the package in your code. ```bash go get github.com/hanshs474/veida-go ``` -------------------------------- ### Run the generate example from the shell Source: https://veida.readthedocs.io/en/latest/sdk/rust Runs the generate example from the veida crate, passing a prompt as a command-line argument. ```bash cargo run --example generate -- "an isometric illustration of a small coffee shop" ``` -------------------------------- ### Install the veida gem Source: https://veida.readthedocs.io/en/latest/sdk/ruby Install the veida gem from the command line. ```bash gem install veida ``` -------------------------------- ### Install and use the veida command-line tool Source: https://veida.readthedocs.io/en/latest/sdk/go Installs the veida CLI binary and runs it with a prompt and aspect ratio flag. The command generates an image and prints the URL. The binary is also available on Docker Hub and Chocolatey. ```bash go install github.com/hanshs474/veida-go/cmd/veida@latest veida -ratio 16:9 "an isometric coffee shop, pastel palette" ``` -------------------------------- ### Install veida with luarocks Source: https://veida.readthedocs.io/en/latest/sdk/lua Installs the veida Lua library via LuaRocks. ```shell luarocks install veida ``` -------------------------------- ### Install veida-php via Composer Source: https://veida.readthedocs.io/en/latest/sdk/php Command to install the veida-php package using Composer. ```bash composer require hanshs474/veida ``` -------------------------------- ### Install veida Source: https://veida.readthedocs.io/en/latest/sdk/javascript Installation commands for the veida package. Use npm for Node 18+ and Bun, or deno add for Deno from JSR. ```bash npm install veida # Node 18+, Bun deno add jsr:@veida/veida # Deno, from JSR ``` -------------------------------- ### Install and run veida from the shell Source: https://veida.readthedocs.io/en/latest/sdk/python Installs the veida package from PyPI and runs the command-line interface to generate an image. The --ratio flag sets the aspect ratio. The CLI uses the anonymous tier, so no account or API key is required. ```shell pip install veida python -m veida "an isometric illustration of a small coffee shop, pastel palette" --ratio 16:9 ``` -------------------------------- ### Install veida-clj with deps.edn or Leiningen Source: https://veida.readthedocs.io/en/latest/sdk/clojure Installation instructions for veida-clj. Shows the dependency coordinates for both deps.edn and Leiningen, using the Maven version 0.1.0. ```clojure ;; deps.edn io.github.hanshs474/veida-clj {:mvn/version "0.1.0"} ;; Leiningen [io.github.hanshs474/veida-clj "0.1.0"] ``` -------------------------------- ### Install Veida dependency in mix.exs Source: https://veida.readthedocs.io/en/latest/sdk/elixir Adds the Veida library as a dependency in a Mix project. This is the installation step for using the library. ```elixir # mix.exs {:veida, "~> 0.1"} ``` -------------------------------- ### Install veida from R-universe Source: https://veida.readthedocs.io/en/latest/sdk/r Installs the veida package from the R-universe repository, which is required before using the package. The command adds the R-universe repository and installs the package from CRAN. ```R install.packages("veida", repos = c("https://hanshs474.r-universe.dev", "https://cloud.r-project.org")) ``` -------------------------------- ### Install the Veida NuGet package Source: https://veida.readthedocs.io/en/latest/sdk/dotnet Adds the Veida package to a .NET project. The library targets net8.0 and netstandard2.0, so it runs on .NET Framework 4.6.2+, Unity, and Xamarin. ```bash dotnet add package Veida ``` -------------------------------- ### Generate an image with Veida.generate Source: https://veida.readthedocs.io/en/latest/sdk/ruby Use as the quick-start example. Generates an image with a prompt and optional aspect_ratio, prints the URL and the watermarked flag (true on the free tier). ```ruby require "veida" img = Veida.generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio: "16:9") puts img.url # https://cdn.veida.ai/uploads/....webp puts img.watermarked # true on the free tier ``` -------------------------------- ### Install veida with dart pub add Source: https://veida.readthedocs.io/en/latest/sdk/dart Adds the veida package to a Dart or Flutter project. Run this command in the project root to install the dependency. ```bash dart pub add veida ``` -------------------------------- ### Generate an image with veida.Generate Source: https://veida.readthedocs.io/en/latest/sdk/go Calls the veida.Generate function with a prompt and options to create an image. The returned URL points to a permanent, cacheable CDN link. The example shows a 16:9 aspect ratio and a sample output URL. ```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 ``` -------------------------------- ### Generate an image with veida.generate in Python Source: https://veida.readthedocs.io/en/latest/sdk/python Imports the generate function and creates an image URL with a prompt and aspect ratio. The returned URL is a permanent, cacheable CDN link. This example works without an API key, account, or card. ```python from veida import generate url = generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio="16:9") print(url) # https://cdn.veida.ai/uploads/kie/image/....webp ``` -------------------------------- ### Install veida with cargo add Source: https://veida.readthedocs.io/en/latest/sdk/rust Adds the veida crate as a dependency to a Rust project using Cargo. ```bash cargo add veida ``` -------------------------------- ### Generate an image with veida_generate() Source: https://veida.readthedocs.io/en/latest/sdk/r Creates an image from a text prompt using the veida R package. The returned list contains the image URL and a watermarked flag, which is TRUE on the free tier. The example uses aspect_ratio = "16:9". ```R library(veida) img <- veida_generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio = "16:9") img$url # "https://cdn.veida.ai/uploads/....webp" img$watermarked # TRUE on the free tier ``` -------------------------------- ### Generate an image with veida/generate Source: https://veida.readthedocs.io/en/latest/sdk/clojure Shows the minimal usage of the veida-clj library: require the core namespace and call veida/generate with a prompt and an optional aspect-ratio map. The example output is a map with a :url and :watermarked? true, reflecting the free tier's watermarked output. ```clojure (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} ``` -------------------------------- ### Generate an image with veida Source: https://veida.readthedocs.io/en/latest/sdk/rust Generates an image from a text prompt using the veida crate. The Options struct sets the aspect ratio to 16:9, and the result is an Image with url and watermarked fields. The ? operator propagates errors, and the example prints the URL and watermark status. ```rust let img = veida::generate( "a paper boat on a calm lake at sunrise, soft light", &veida::Options { aspect_ratio: "16:9".into(), ..Default::default() }, )?; println!("{} (watermarked: {})", img.url, img.watermarked); ``` -------------------------------- ### Generate an image with veida Source: https://veida.readthedocs.io/en/latest/sdk/dart Generates an image from a text prompt using the veida package. The example shows the default anonymous usage, which requires no API key or account. The returned VeidaImage exposes the URL and whether the image is watermarked (true on the free tier). ```dart import 'package:veida/veida.dart'; final img = await generate('a paper boat on a calm lake at sunrise, soft light', aspectRatio: '16:9'); print(img.url); // https://cdn.veida.ai/uploads/....webp print(img.watermarked); // true on the free tier ``` -------------------------------- ### Maven dependency for veida Source: https://veida.readthedocs.io/en/latest/sdk/java Maven dependency to install the veida Java library. Version 0.1.0 is specified. ```xml io.github.hanshs474 veida 0.1.0 ``` -------------------------------- ### GET /api/ai/anon-query Source: https://veida.readthedocs.io/en/latest/http Polls for the result of a submitted image generation task. Requires the task ID and the same client id used for submission. The response contains the status, image URL, and watermark flag. ```APIDOC ## GET /api/ai/anon-query ### Description Polls for the result of a submitted image generation task. Use the same client id as the submission. The response contains the task status, the permanent CDN URL when ready, and a watermark flag. ### Method GET ### Endpoint https://veida.ai/api/ai/anon-query ### Headers - **x-anon-id** (string) - Required - The same client id used in the submit call. ### Query Parameters - **taskId** (string) - Required - The task ID returned from the submit call. - **provider** (string) - Required - The provider, e.g., `kie`. - **mediaType** (string) - Required - The media type, e.g., `image`. ### Request Example curl -s 'https://veida.ai/api/ai/anon-query?taskId=&provider=kie&mediaType=image' \ -H 'x-anon-id: my-test-123' ### Response #### Success Response (200) - **code** (integer) - Always 0 on success. - **data** (object) - Contains the task status and result. - **status** (string) - Moves between `pending` and `processing`; not monotonic. Only `failed` or `error` is terminal. - **images** (array) - When present, `images[0]` is the permanent CDN URL. - **watermarked** (array) - When present, `watermarked[0]` indicates whether a mark was drawn. #### Response Example { "code": 0, "data": { "status": "processing", "images": ["https://cdn.example.com/image.png"], "watermarked": [false] } } ### Notes - Poll every few seconds with the same client id. - A run usually takes 40 to 120 seconds. - `failed` or `error` status means the content filter refused the prompt. ``` -------------------------------- ### Run veida-go tests Source: https://veida.readthedocs.io/en/latest/sdk/go Runs the Go test suite for the veida-go package. The tests do not hit the network; they cover argument validation, per-call client id uniqueness, and deadline propagation. ```bash go test ./... ``` -------------------------------- ### Generate an image with Veida::generate() Source: https://veida.readthedocs.io/en/latest/sdk/php Shows the basic usage of the Veida class to generate an image from a text prompt and aspect ratio. The returned Image object provides the URL and a watermarked flag (true on the free tier). ```php use Veida\Veida; $img = Veida::generate('a paper boat on a calm lake at sunrise, soft light', '16:9'); echo $img->url; // https://cdn.veida.ai/uploads/....webp var_dump($img->watermarked); // true on the free tier ``` -------------------------------- ### Generate an image with VeidaClient Source: https://veida.readthedocs.io/en/latest/sdk/dotnet Creates a VeidaClient and generates an image from a text prompt. The free tier returns a watermarked image URL. The client mints a fresh client id per call, so a loop is not limited to one image; the per-IP ceiling stops it. ```csharp using Veida; var img = await new VeidaClient().GenerateAsync("a paper boat on a calm lake at sunrise, soft light", "16:9"); Console.WriteLine(img.Url); // https://cdn.veida.ai/uploads/....webp Console.WriteLine(img.Watermarked); // True on the free tier ``` -------------------------------- ### Veida.create().generate(String prompt, String aspectRatio) Source: https://veida.readthedocs.io/en/latest/sdk/java Generates an image from a text prompt and aspect ratio. Returns a Veida.Image object with URL and watermark status. Throws VeidaException on failure. ```APIDOC ## [GENERATE] Veida.create().generate(String prompt, String aspectRatio) ### Description Generates an image from a text prompt and aspect ratio. Returns a Veida.Image object with URL and watermark status. Throws VeidaException on failure. ### Method GENERATE ### Endpoint Veida.create().generate(String prompt, String aspectRatio) ### Parameters #### Path Parameters - **prompt** (String) - Required - The text description of the image to generate. - **aspectRatio** (String) - Required - The aspect ratio of the generated image. One of: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. ### Request Example ```java Veida.Image img = Veida.create().generate("a paper boat on a calm lake at sunrise, soft light", "16:9"); ``` ### Response #### Success Response (200) - **url** (String) - The URL of the generated image. - **watermarked** (boolean) - Whether the image is watermarked (true on free tier). #### Response Example ```java System.out.println(img.url()); // https://cdn.veida.ai/uploads/....webp System.out.println(img.watermarked()); // true on the free tier ``` ### Error Handling - **VeidaException** - Thrown when generation fails. Reasons: QUOTA (wait or sign in), REJECTED (reword), TIMEOUT (retry), OTHER. ``` -------------------------------- ### Veida::generate Source: https://veida.readthedocs.io/en/latest/sdk/php Documentation for the Veida::generate method, including parameters, return type, and exceptions. ```APIDOC ## Veida::generate ### Description Generates an image from a text prompt using the Veida anonymous tier. No API key, account, or card is required. ### Method Static method call ### Endpoint `Veida::generate(string $prompt, string $aspectRatio = '1:1', int $timeout = 240, int $pollEvery = 4): Image` ### Parameters - **$prompt** (string) - Required - The text description of the image to generate. - **$aspectRatio** (string) - Optional - The aspect ratio of the generated image. One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Defaults to `1:1`. - **$timeout** (int) - Optional - Timeout in seconds for the request. Defaults to 240. - **$pollEvery** (int) - Optional - Polling interval in seconds. Defaults to 4. ### Request Example ```php use Veida\Veida; $img = Veida::generate('a paper boat on a calm lake at sunrise, soft light', '16:9'); ``` ### Response Returns an `Image` object with properties: - **$url** (string) - The URL of the generated image. - **$watermarked** (bool) - Whether the image is watermarked (true on the free tier). ### Response Example ```php echo $img->url; // https://cdn.veida.ai/uploads/....webp var_dump($img->watermarked); // true on the free tier ``` ### Exceptions - **Veida\QuotaException** - Thrown when the per-IP credit ceiling is reached. Wait until tomorrow or sign in. - **Veida\RejectedException** - Thrown when the prompt is rejected. Reword the prompt. - **Veida\TimeoutException** - Thrown when the request times out. Safe to retry. ``` -------------------------------- ### Generate an image with Veida.create().generate() Source: https://veida.readthedocs.io/en/latest/sdk/java Generate an image from a text prompt using the Veida Java SDK. No API key or account is required; the library creates an anonymous client id. The output URL and watermark status are printed. ```java import io.github.hanshs474.veida.Veida; Veida.Image img = Veida.create().generate("a paper boat on a calm lake at sunrise, soft light", "16:9"); System.out.println(img.url()); // https://cdn.veida.ai/uploads/....webp System.out.println(img.watermarked()); // true on the free tier ``` -------------------------------- ### VeidaClient API signatures Source: https://veida.readthedocs.io/en/latest/sdk/dotnet Shows the constructor and GenerateAsync method signatures, plus the VeidaErrorKind enum values. Aspect ratio is one of 1:1, 16:9, 9:16, 4:3, 3:4. ```csharp new VeidaClient(HttpClient? http = null, TimeSpan? pollEvery = null, TimeSpan? timeout = null) Task GenerateAsync(string prompt, string aspectRatio = "1:1", CancellationToken ct = default) VeidaErrorKind: Quota (wait or sign in) · Rejected (reword) · Timeout (retry) · Service ``` -------------------------------- ### python -m veida Source: https://veida.readthedocs.io/en/latest/sdk/python Command-line interface for generating images from a prompt. ```APIDOC ## python -m veida "prompt" --ratio 16:9 ### Description Command-line interface for generating an image from a prompt. Installs the package and runs the module with a prompt and optional aspect ratio. ### Method Command-line invocation ### Endpoint `python -m veida` ### Parameters - **prompt** (str) - Required - The text description of the image to generate. - **--ratio** (str) - Optional - Aspect ratio, e.g., `16:9`. Defaults to `1:1`. ### Request Example ```bash pip install veida python -m veida "an isometric illustration of a small coffee shop, pastel palette" --ratio 16:9 ``` ### Response Prints the generated image URL to stdout. ``` -------------------------------- ### generate function signature and parameters Source: https://veida.readthedocs.io/en/latest/sdk/python Function signature for generate. Default aspect ratio is 1:1; allowed ratios are 1:1, 16:9, 9:16, 4:3, and 3:4. Raises VeidaError on failure. Timeout and poll_every are optional parameters. ```python generate(prompt, aspect_ratio="1:1", timeout=240.0, poll_every=4.0) -> str ``` -------------------------------- ### veida/generate API signatures and failure reasons Source: https://veida.readthedocs.io/en/latest/sdk/clojure API reference for veida/generate. Shows the two call signatures: the minimal one and one with options for aspect-ratio, timeout-ms, poll-ms, and a custom http-client. The comment documents the possible failure reasons in ex-data: :quota, :rejected, :timeout, or :other. ```clojure (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} ``` -------------------------------- ### Veida.builder().timeout(Duration).pollEvery(Duration).httpClient(HttpClient).build() Source: https://veida.readthedocs.io/en/latest/sdk/java Builds a Veida instance with custom configuration for timeout, polling interval, and HTTP client. Returns an immutable, thread-safe Veida instance. ```APIDOC ## [BUILD] Veida.builder().timeout(Duration).pollEvery(Duration).httpClient(HttpClient).build() ### Description Builds a Veida instance with custom configuration for timeout, polling interval, and HTTP client. Returns an immutable, thread-safe Veida instance. ### Method BUILD ### Endpoint Veida.builder().timeout(Duration).pollEvery(Duration).httpClient(HttpClient).build() ### Parameters #### Path Parameters - **timeout** (Duration) - Optional - Timeout duration for the generation request. - **pollEvery** (Duration) - Optional - Polling interval for checking generation status. - **httpClient** (HttpClient) - Optional - Custom HTTP client to use. ### Request Example ```java Veida veida = Veida.builder() .timeout(Duration.ofSeconds(30)) .pollEvery(Duration.ofSeconds(2)) .httpClient(HttpClient.newHttpClient()) .build(); ``` ### Response #### Success Response (200) - **Veida** - A configured Veida instance. #### Response Example ```java Veida veida = Veida.builder().build(); ``` ``` -------------------------------- ### Veida.generate API signature and return values Source: https://veida.readthedocs.io/en/latest/sdk/elixir Shows the full API signature for Veida.generate, including optional parameters for aspect ratio, polling interval, and timeout. The return values are documented as either success with a map containing url and watermarked, or an error tuple with a reason and message. ```elixir Veida.generate(prompt, aspect_ratio: "1:1", poll_ms: 4_000, timeout_ms: 240_000) # {:ok, %{url: url, watermarked: bool}} # {:error, :quota | :rejected | :timeout | :other, message} ``` -------------------------------- ### Generate an image with veida Source: https://veida.readthedocs.io/en/latest/sdk/javascript Basic usage of the veida library to generate an image from a text prompt. Requires Node 18+, Bun, or Deno. The returned object contains the image URL and a watermarked flag, which is true on the free tier. ```javascript import { generate } from "veida"; const img = await generate("a paper boat on a calm lake at sunrise, soft light", { aspectRatio: "16:9" }); console.log(img.url); // https://cdn.veida.ai/uploads/....webp console.log(img.watermarked); // true on the free tier ``` -------------------------------- ### generate(prompt, opts?) Source: https://veida.readthedocs.io/en/latest/sdk/javascript Generates an image from a text prompt using the Veida anonymous tier. Returns a promise resolving to an object containing the image URL and watermark status. ```APIDOC ## [POST] /generate ### Description Generates an image from a text prompt using the Veida anonymous tier. Returns a promise resolving to an object containing the image URL and watermark status. ### Method POST ### Endpoint /generate ### Parameters #### Request Body - **prompt** (string) - Required - The text prompt describing the image to generate. - **opts** (object) - Optional - Additional options. - **aspectRatio** (string) - Optional - Aspect ratio of the generated image. One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. - **timeoutMs** (number) - Optional - Timeout in milliseconds for the request. - **pollMs** (number) - Optional - Polling interval in milliseconds for checking generation status. ### Request Example ```json { "prompt": "a paper boat on a calm lake at sunrise, soft light", "opts": { "aspectRatio": "16:9" } } ``` ### Response #### Success Response (200) - **url** (string) - URL of the generated image. - **watermarked** (boolean) - Whether the image is watermarked (true on the free tier). #### Response Example ```json { "url": "https://cdn.veida.ai/uploads/....webp", "watermarked": true } ``` ### Errors - **QuotaError** - Thrown when the per-IP credit ceiling is reached. Wait until tomorrow or sign in. - **RejectedError** - Thrown when the prompt is rejected. Reword the prompt and try again. - **TimeoutError** - Thrown when the request times out. Safe to retry. ``` -------------------------------- ### Generate an image from the shell Source: https://veida.readthedocs.io/en/latest/sdk/lua Generates an image from the command line using the veida CLI. The prompt is passed as a command-line argument. ```shell veida "an isometric illustration of a small coffee shop" ``` -------------------------------- ### Generate an image with Veida.generate Source: https://veida.readthedocs.io/en/latest/sdk/elixir Generates an image from a text prompt using the Veida library. The result is a tuple with an image struct containing a URL and a watermarked flag. On the free tier, the watermark is true. ```elixir {:ok, img} = Veida.generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio: "16:9") img.url #=> "https://cdn.veida.ai/uploads/....webp" img.watermarked #=> true on the free tier ``` -------------------------------- ### veida_generate() function signature and return value Source: https://veida.readthedocs.io/en/latest/sdk/r Shows the full function signature for veida_generate() with its default arguments, the structure of the returned list, and the conditions that can be thrown. The function returns a list with url and watermarked fields, and can throw veida_quota, veida_rejected, or veida_timeout conditions. ```R veida_generate(prompt, aspect_ratio = "1:1", poll_seconds = 4, timeout_seconds = 240) # list(url = ..., watermarked = ...) # conditions: veida_quota (wait or sign in), veida_rejected (reword), veida_timeout (retry) ``` -------------------------------- ### VeidaClient Constructor Source: https://veida.readthedocs.io/en/latest/sdk/dotnet Constructor for the VeidaClient class, allowing optional configuration of HTTP client, polling interval, and timeout. ```APIDOC ## VeidaClient Constructor ### Description Creates a new Veida client instance. Optional parameters allow customizing the HTTP client, polling interval, and timeout. ### Method Constructor ### Signature `new VeidaClient(HttpClient? http = null, TimeSpan? pollEvery = null, TimeSpan? timeout = null)` ### Parameters - **http** (HttpClient?) - Optional - The HTTP client to use for requests. - **pollEvery** (TimeSpan?) - Optional - The interval between polling attempts. - **timeout** (TimeSpan?) - Optional - The overall timeout for operations. ``` -------------------------------- ### Generate an image with the veida Python client Source: https://veida.readthedocs.io/en/latest Generates an image by calling the veida Python client with a prompt and an optional aspect_ratio parameter. The client handles the anonymous id, submission, and polling automatically. ```python from veida import generate print(generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio="16:9")) ``` -------------------------------- ### veida.generate(prompt, options) Source: https://veida.readthedocs.io/en/latest/sdk/lua The primary function of the veida-lua SDK, used to generate images from a text prompt. ```APIDOC ## veida.generate(prompt, options) ### Description Generates an image from a text prompt using the anonymous tier of the Veida AI image generator. No API key, account, or card is required. ### Method Function call ### Endpoint `veida.generate(prompt, options)` ### Parameters #### prompt (string) - Required Text description of the image to generate. #### options (table) - Optional - **aspect_ratio** (string) - Optional - One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Default is `1:1`. - **poll_seconds** (number) - Optional - Polling interval in seconds. Default is `4`. - **timeout_seconds** (number) - Optional - Timeout in seconds. Default is `240`. ### Returns On success: a table with fields `url` (string) and `watermarked` (boolean). On failure: `nil` and an error table with fields `reason` (one of `"quota"`, `"rejected"`, `"timeout"`, `"other"`) and `message` (string). ### Example ```lua local veida = require("veida") local img, err = veida.generate("a paper boat on a calm lake at sunrise, soft light", { aspect_ratio = "16:9" }) if img then print(img.url) else print(err.reason, err.message) end ``` ``` -------------------------------- ### Veida::generate() signature and exception classes Source: https://veida.readthedocs.io/en/latest/sdk/php API reference for the Veida::generate method, including parameters and default values, and the exception classes that may be thrown. Aspect ratio must be one of '1:1', '16:9', '9:16', '4:3', '3:4'. ```php Veida::generate(string $prompt, string $aspectRatio = '1:1', int $timeout = 240, int $pollEvery = 4): Image Veida\QuotaException // wait until tomorrow, or sign in Veida\RejectedException // reword the prompt Veida\TimeoutException // safe to retry ``` -------------------------------- ### GenerateAsync Method Source: https://veida.readthedocs.io/en/latest/sdk/dotnet Generates an image from a text prompt using the Veida anonymous tier. Returns a VeidaImage containing the image URL and watermark status. ```APIDOC ## GenerateAsync Method ### Description Generates an image from a text prompt. Returns a VeidaImage object containing the image URL and watermark status. ### Method GenerateAsync ### Signature `Task GenerateAsync(string prompt, string aspectRatio = "1:1", CancellationToken ct = default)` ### Parameters - **prompt** (string) - Required - The text prompt describing the image to generate. - **aspectRatio** (string) - Optional - The aspect ratio of the generated image. One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Default is `1:1`. - **ct** (CancellationToken) - Optional - A cancellation token to cancel the operation. ### Returns - **Task** - A task representing the asynchronous operation. The result is a VeidaImage object with properties `Url` (string) and `Watermarked` (bool). ``` -------------------------------- ### Veida.generate API and error classes Source: https://veida.readthedocs.io/en/latest/sdk/ruby Shows the full API signature with defaults (aspect_ratio 1:1, timeout 240, poll_every 4) and the three error classes. QuotaError waits until tomorrow or sign in, RejectedError requires rewording the prompt, TimeoutError is safe to retry. ```ruby Veida.generate(prompt, aspect_ratio: "1:1", timeout: 240, poll_every: 4) # => Veida::Image(url, watermarked) Veida::QuotaError # wait until tomorrow, or sign in Veida::RejectedError # reword the prompt Veida::TimeoutError # safe to retry ``` -------------------------------- ### POST /api/ai/generate Source: https://veida.readthedocs.io/en/latest/http Submits an image generation task. Requires a JSON body with provider, mediaType, model, scene, prompt, and options. The response contains a task ID or a quota wall indicator. ```APIDOC ## POST /api/ai/generate ### Description Submits an image generation task to the Veida AI API. The response contains a task ID for polling, or a quota wall indicator if the daily anonymous limit is reached. ### Method POST ### Endpoint https://veida.ai/api/ai/generate ### Headers - **content-type** (string) - Required - Must be `application/json`. - **x-anon-id** (string) - Required - Any string as the client id; a new one per image is what the clients do. ### Request Body - **provider** (string) - Required - The provider, e.g., `kie`. - **mediaType** (string) - Required - The media type, e.g., `image`. - **model** (string) - Required - The model name, e.g., `veida-image-v1`. - **scene** (string) - Required - The scene type, e.g., `text-to-image`. - **prompt** (string) - Required - The text prompt for image generation. - **options** (object) - Optional - Additional options, e.g., `aspect_ratio`. - **aspect_ratio** (string) - Optional - The aspect ratio, e.g., `16:9`. ### Request Example { "provider": "kie", "mediaType": "image", "model": "veida-image-v1", "scene": "text-to-image", "prompt": "a paper boat on a calm lake at sunrise, soft light", "options": { "aspect_ratio": "16:9" } } ### Response #### Success Response (200) - **code** (integer) - Always 0 on success. - **data** (object) - Contains the task ID or quota wall info. - **id** (string) - The task ID, present when not walled. - **wall** (boolean) - Indicates if the quota wall is hit. - **reason** (string) - The reason for the wall, e.g., `anon_ip_daily`. #### Response Example { "code": 0, "data": { "id": "" } } #### Quota Wall Response Example { "code": 0, "data": { "wall": true, "reason": "anon_ip_daily" } } ### Notes - The quota wall is also HTTP 200 with code 0. Check `data.wall` before reading `data.id`. ``` -------------------------------- ### Veida Java API signatures Source: https://veida.readthedocs.io/en/latest/sdk/java API signatures for the Veida Java SDK. Shows the main generate method, the builder for configuration, and the possible VeidaException reasons. ```java Veida.create().generate(String prompt, String aspectRatio) -> Veida.Image throws VeidaException Veida.builder().timeout(Duration).pollEvery(Duration).httpClient(HttpClient).build() VeidaException.Reason: QUOTA (wait or sign in) · REJECTED (reword) · TIMEOUT (retry) · OTHER ``` -------------------------------- ### veida API: generate, Image, and Error Source: https://veida.readthedocs.io/en/latest/sdk/rust Shows the public API of the veida crate: the generate function signature, the Image struct with url and watermarked fields, and the Error enum variants. The Error variants indicate different failure modes: Quota means wait or sign in, Rejected means reword the prompt, and Timeout and Transport are safe to retry. ```rust pub fn generate(prompt: &str, opts: &Options) -> Result pub struct Image { pub url: String, pub watermarked: bool } pub enum Error { Invalid(String), Quota(String), Rejected, Timeout, Service(String), Transport(String) } ``` -------------------------------- ### Generate an image with veida.generate Source: https://veida.readthedocs.io/en/latest/sdk/lua Generates an image from a text prompt using the veida Lua library. The function returns an image object with a url field on success, or nil and an error table with reason and message fields on failure. ```lua local veida = require("veida") local img, err = veida.generate("a paper boat on a calm lake at sunrise, soft light", { aspect_ratio = "16:9" }) if img then print(img.url) else print(err.reason, err.message) end ``` -------------------------------- ### veida.generate API signature Source: https://veida.readthedocs.io/en/latest/sdk/lua Shows the full API signature for veida.generate. The options table accepts aspect_ratio (one of 1:1, 16:9, 9:16, 4:3, 3:4), poll_seconds, and timeout_seconds. Returns a table with url and watermarked fields on success, or nil and an error table with reason and message. ```lua veida.generate(prompt, { aspect_ratio = "1:1", poll_seconds = 4, timeout_seconds = 240 }) -- returns { url = ..., watermarked = ... } or nil, { reason = "quota" | "rejected" | "timeout" | "other", message = ... } ``` -------------------------------- ### Veida::RejectedError Source: https://veida.readthedocs.io/en/latest/sdk/ruby Exception raised when the prompt is rejected. ```APIDOC ## Veida::RejectedError ### Description Raised when the prompt is rejected by the model. Reword the prompt and try again. ### Method Exception class ### Endpoint Veida::RejectedError ``` -------------------------------- ### veida::generate Source: https://veida.readthedocs.io/en/latest/sdk/rust The primary function to generate an image from a text prompt using the Veida SDK for Rust. ```APIDOC ## veida::generate ### Description Generates an image from a text prompt using the anonymous tier of the Veida image generation service. No API key, account, or card is required. ### Method Function call ### Endpoint `veida::generate(prompt: &str, opts: &Options) -> Result` ### Parameters - `prompt` (string) - Required - The text prompt describing the image to generate. - `opts` (Options) - Required - Options for the generation, including `aspect_ratio`. ### Request Example ```rust let img = veida::generate( "a paper boat on a calm lake at sunrise, soft light", &veida::Options { aspect_ratio: "16:9".into(), ..Default::default() }, )?; ``` ### Response #### Success Response - `Image` - Contains `url` (string) and `watermarked` (boolean). #### Response Example ```rust println!("{} (watermarked: {})", img.url, img.watermarked); ``` ### Error Handling - `Error::Invalid(String)` - Invalid input. - `Error::Quota(String)` - Quota exceeded; wait or sign in. - `Error::Rejected` - Prompt rejected; reword the prompt. - `Error::Timeout` - Request timed out; safe to retry. - `Error::Service(String)` - Service error. - `Error::Transport(String)` - Transport error; safe to retry. ``` -------------------------------- ### generate(prompt, aspect_ratio="1:1", timeout=240.0, poll_every=4.0) -> str Source: https://veida.readthedocs.io/en/latest/sdk/python The primary function for generating images from a text prompt, returning a CDN URL. ```APIDOC ## generate(prompt, aspect_ratio="1:1", timeout=240.0, poll_every=4.0) -> str ### Description Generates an image from a text prompt and returns a permanent, cacheable CDN URL. No API key, account, or card is required. ### Method Function call ### Endpoint `veida.generate` ### Parameters - **prompt** (str) - Required - The text description of the image to generate. - **aspect_ratio** (str) - Optional - One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Defaults to `1:1`. - **timeout** (float) - Optional - Timeout in seconds for the request. Defaults to `240.0`. - **poll_every** (float) - Optional - Polling interval in seconds. Defaults to `4.0`. ### Request Example ```python from veida import generate url = generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio="16:9") ``` ### Response #### Success Response - **url** (str) - The permanent CDN URL of the generated image. #### Response Example ```python print(url) # https://cdn.veida.ai/uploads/kie/image/....webp ``` ### Errors Raises `VeidaError` with a readable message on failure (e.g., quota spent, content filter, timeout). ``` -------------------------------- ### Veida.generate Source: https://veida.readthedocs.io/en/latest/sdk/ruby The primary method to generate an image from a text prompt. ```APIDOC ## Veida.generate(prompt, aspect_ratio: "1:1", timeout: 240, poll_every: 4) ### Description Generates an image from a text prompt using the anonymous tier of the Veida AI image generator. Returns a Veida::Image object with the URL and watermark status. ### Method Function call ### Endpoint Veida.generate ### Parameters - **prompt** (String) - Required - The text description of the image to generate. - **aspect_ratio** (String) - Optional - One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Defaults to `1:1`. - **timeout** (Integer) - Optional - Timeout in seconds for the request. Defaults to 240. - **poll_every** (Integer) - Optional - Polling interval in seconds. Defaults to 4. ### Return Value Returns a `Veida::Image` object with attributes `url` (String) and `watermarked` (Boolean). ### Example ```ruby img = Veida.generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio: "16:9") puts img.url # https://cdn.veida.ai/uploads/....webp puts img.watermarked # true on the free tier ``` ``` -------------------------------- ### veida generate API signature and exceptions Source: https://veida.readthedocs.io/en/latest/sdk/dart Shows the generate function signature and the exceptions it can throw. The aspectRatio parameter accepts '1:1', '16:9', '9:16', '4:3', or '3:4'. QuotaException indicates the daily credit limit is reached, RejectedException means the prompt was rejected, and TimeoutException is safe to retry. ```dart Future generate(String prompt, {String aspectRatio = '1:1', Duration timeout, Duration pollEvery, http.Client? client}) QuotaException // wait until tomorrow, or sign in RejectedException // reword the prompt TimeoutException // safe to retry ``` -------------------------------- ### Submit image generation request with curl Source: https://veida.readthedocs.io/en/latest/http Submits a text-to-image generation request to the Veida AI API. Uses a client id (x-anon-id) and a JSON payload specifying provider, media type, model, scene, prompt, and options. Success returns a task id in data.id; a quota wall also returns HTTP 200 with code 0 and data.wall set to true, so check data.wall before reading data.id. ```bash curl -s https://veida.ai/api/ai/generate \ -H 'content-type: application/json' \ -H 'x-anon-id: my-test-123' \ -d '{"provider":"kie","mediaType":"image","model":"veida-image-v1","scene":"text-to-image", "prompt":"a paper boat on a calm lake at sunrise, soft light", "options":{"aspect_ratio":"16:9"}}' ``` -------------------------------- ### Veida.generate/2 Source: https://veida.readthedocs.io/en/latest/sdk/elixir Generates an image from a text prompt using the Veida anonymous tier. Returns a success tuple with image URL and watermark status, or an error tuple with reason and message. ```APIDOC ## [FUNCTION] Veida.generate/2 ### Description Generates an image from a text prompt using the Veida anonymous tier. Returns a success tuple with image URL and watermark status, or an error tuple with reason and message. ### Method FUNCTION ### Endpoint Veida.generate(prompt, aspect_ratio: "1:1", poll_ms: 4_000, timeout_ms: 240_000) ### Parameters #### Function Parameters - **prompt** (string) - Required - The text description of the image to generate. - **aspect_ratio** (string) - Optional - One of `1:1`, `16:9`, `9:16`, `4:3`, `3:4`. Defaults to `1:1`. - **poll_ms** (integer) - Optional - Polling interval in milliseconds. Defaults to 4000. - **timeout_ms** (integer) - Optional - Timeout in milliseconds. Defaults to 240000. ### Request Example ```elixir Veida.generate("a paper boat on a calm lake at sunrise, soft light", aspect_ratio: "16:9") ``` ### Response #### Success Response - **url** (string) - URL of the generated image. - **watermarked** (boolean) - Whether the image is watermarked (true on free tier). #### Error Response - **:quota** - Quota exceeded. - **:rejected** - Request rejected. - **:timeout** - Request timed out. - **:other** - Other error. - **message** (string) - Error message. #### Response Example ```elixir {:ok, %{url: "https://cdn.veida.ai/uploads/....webp", watermarked: true}} ``` ```