🎨Alpha Visuals API

Generate memes, edit images, and more!

Pipelines


Alpha Visuals API provides access to all of our Graphic Pipelines: Text-to-Image, Effect, and Mirage. Read about Authentification if that's your first time using Alpha API.

Input image requirements: PNG or JPG format, size under 2MB

Create an image from a text prompt

Create an image from a text prompt

POST/visuals/create_image
Authorization
Header parameters
Body
prompt*Prompt
seedSeed
widthWidth
heightHeight
allow_nsfw*Allow Nsfw
Response

Image file in PNG format

Body
any
Request
const response = await fetch('/visuals/create_image', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "prompt": "text",
      "allow_nsfw": false
    }),
});
const data = await response.json();
Response
{
  "detail": [
    {
      "loc": [
        "text"
      ],
      "msg": "text",
      "type": "text"
    }
  ]
}

Code examples in the next two widgets are WRONG! There seems to be a bug on GitBook's side. Refer to Sending form-data requests for the correct code snippet.

Apply an effect to an image

Apply an effect to an image

POST/visuals/apply_effect
Authorization
Header parameters
Body
image*Image
prompt*Prompt
seedSeed
allow_nsfwAllow Nsfw
Response

Image file in PNG format

Body
any
Request
const response = await fetch('/visuals/apply_effect', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "multipart/form-data"
    },
    body: JSON.stringify({
      "image": "binary",
      "prompt": "text"
    }),
});
const data = await response.json();
Response
{
  "detail": [
    {
      "loc": [
        "text"
      ],
      "msg": "text",
      "type": "text"
    }
  ]
}

Sending form-data requests

/visuals/apply_effect and /visuals/appy_mirage are using multipart/form-data format. Imagine you have a file named selfie.png. In this case, you'll need to call the following code:

import requests  # Run `pip install requests` if you haven't installed it yet

url = 'https://api.alphakek.ai/visuals/apply_effect'
headers = {
    'accept': 'application/json',
    'Authorization': 'Bearer XXXXX'  # Replace with your API key
}
files = {
    'image': ('selfie.png', open('selfie.png', 'rb'), 'image/png')
}
data = {
    'prompt': 'scary clown',  # modifty these parameters as needed
    'seed': '123456',
    'allow_nsfw': 'true'
}

response = requests.post(url, headers=headers, files=files, data=data)

if response.status_code == 200:
    with open('output.png', 'wb') as f:
        f.write(response.content)
else:
    print(f"Failed with status code {response.status_code}")
    print(response.text)

Chat API Costs


Each API call costs 1 credit. Read more at API Credits.

Last updated