How to use CryptoTalks Image Generation

First, make sure you have an account and sufficient funds. Prices are listed at Image Generation Models in USD per 1 million pixel steps.

Then, send a POST request to the following endpoint:

https://cryptotalks.ai/v1/image_generation

The request body should be a JSON object with the following fields:

There are a few optional fields you can use, you can find more information about them in the Image Generation API Reference.

For example, in python:

import base64
import json
import os
import ssl
import requests

cryptotalks_api_key = "YOUR_API_KEY"
def generate_image(base, model, prompt, width, height, **kwargs):
    url = f"https://cryptotalks.ai/v1/image_generation"
    headers = {
        "accept": "application/json",
        "content-type": "application/json",
        "Authorization": f"Bearer {cryptotalks_api_key}",
    }
    data = {
        "base": base,
        "model": model,
        "prompt": prompt,
        "width": width,
        "height": height,
        **kwargs,
    }
    response = requests.post(url, headers=headers, json=data)
    response_data = response.json()
    image_data = response_data["image"]
    image_bytes = base64.b64decode(image_data)
    output_filename = f"image_{width}x{height}.png"
    output_path = os.path.join(here_path, output_filename)
    with open(output_path, "wb") as image_file:
        image_file.write(image_bytes)


generate_image(
    base="stable-diffusion-xl",
    model="reproduction-v3-31",
    prompt="sexy privacy supporter",
    width=1024,
    height=1024,
)