Lexica.art icon indicating copy to clipboard operation
Lexica.art copied to clipboard

An easy-to-use reverse engineered text to image generation Python API wrapper for Lexica.art

Lexica.art API

An easy-to-use reverse engineered Python API wrapper for Lexica.art

Usage

Searching For Images Using The API

from Lex import Lexica

lex = Lexica(query="icecream").images()
print(lex)

It will return you a list with the image links

Generating Images Using The API

You must have a registered account on Lexica first.

Once you're registered you need the cookie from the site. To find the cookie open Inspect Tools then navigate to the Network Tab and start recording the requests. Generate an image and intercept the requests, there you'll find a request named generator open the requests and scroll down until you find the cookie parameter in the headers section of the request

Untitled

Copy the entire cookie value and store it in a variable or a file.

from Lex import Lexica

cookie="YOUR COOKIE"

lex = Lexica(query="icecream",cookie=cookie).generate()
print(lex)

It will return you a list with the image links

Additional Configurations

  • negativePrompt: Default to None
  • guidanceScale: Default to 7
  • portrait: Default to True (If set to False will generate a landscape image with ratio (768,512))

Demo Web UI made using the API Wrapper

If you are interested feel free to check it out, Aperture

image

Thank You

  • I hope you found this useful, If you did consider giving it a star <3