ExBifrost.Api.Images (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged Images.

Summary

Functions

Edit an image Edits an image using a text prompt and optional mask. Request must be sent as multipart/form-data with at least model, prompt (unless type is background_removal), and image (or image[]).

Generate an image Generates images from text prompts using the specified model.

Create Variation Creates variations of an image. Request must be sent as multipart/form-data with model and image (or image[]). Does not support streaming.

Functions

image_edit(connection, model, image, opts \\ [])

Edit an image Edits an image using a text prompt and optional mask. Request must be sent as multipart/form-data with at least model, prompt (unless type is background_removal), and image (or image[]).

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • model (String.t): Model identifier in format provider/model
  • image (String.t): Image file to edit. Use field name image for a single file or image[] for multiple files.
  • opts (keyword): Optional parameters
    • :prompt (String.t): Text prompt describing the edit. Required unless type is background_removal.
    • :mask (String.t): Optional mask image for inpainting (transparent areas indicate regions to edit)
    • :type (String.t): Type of edit operation
    • :n (integer()): Number of images to generate
    • :size (String.t): Size of the output image
    • :response_format (String.t): Format of the response
    • :stream (boolean()): When true, stream the response via Server-Sent Events
    • :background (String.t): Background type for the image
    • :input_fidelity (String.t): How closely to follow the original image
    • :partial_images (integer()): Number of partial images to generate when streaming
    • :quality (String.t): Quality of the output image
    • :output_format (String.t): Output image format
    • :num_inference_steps (integer()): Number of inference steps
    • :seed (integer()): Seed for reproducible editing
    • :output_compression (integer()): Compression level (0-100%)
    • :negative_prompt (String.t): What to avoid in the edit
    • :user (String.t): User identifier for tracking
    • :fallbacks ([ExBifrost.Model.Fallback.t]): Fallback models to try if primary model fails

Returns

  • {:ok, ExBifrost.Model.ImageGeneration200Response.t} on success
  • {:error, Tesla.Env.t} on failure

image_generation(connection, image_generation_request, opts \\ [])

Generate an image Generates images from text prompts using the specified model.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • image_generation_request (ImageGenerationRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.ImageGeneration200Response.t} on success
  • {:error, Tesla.Env.t} on failure

image_variation(connection, model, image, opts \\ [])

Create Variation Creates variations of an image. Request must be sent as multipart/form-data with model and image (or image[]). Does not support streaming.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • model (String.t): Model identifier in format provider/model
  • image (String.t): Image file to create variations of. Use field name image for a single file or image[] for multiple (first image is used).
  • opts (keyword): Optional parameters
    • :n (integer()): Number of variations to generate
    • :size (String.t): Size of the output images
    • :response_format (String.t): Format of the response
    • :user (String.t): User identifier for tracking
    • :fallbacks ([ExBifrost.Model.Fallback.t]): Fallback models to try if primary model fails

Returns

  • {:ok, ExBifrost.Model.ImageGeneration200Response.t} on success
  • {:error, Tesla.Env.t} on failure