👷Using the API

Integrate image creation into your workflows using the dreamlook.ai API

Start an image generation job

  1. Generate an API key on dreamlook.ai/api-keys. Treat this key like a password: keep it safe, and don't expose it publicly!

  2. Export your API key as the environment variable DREAMLOOK_API_KEY :

export DREAMLOOK_API_KEY="dl-YOURKEYHERE"
  1. Go to https://dreamlook.ai/image-gen and configure your generation parameters as described in Using the website

  2. Copy the content of "API request" and paste it into a terminal. Running the command will trigger a new generation job:

  1. You will get a unique job ID as a response:

{
    "job_id":"ig_63d83f95"
}

Jobs created from the API are also visible from the website, so you can check https://dreamlook.ai/jobs/image-gen to see how your job is progressing.

Keeping track of your jobs

Check the documentation in Using the API to see how to list your jobs and check their state. Image generation jobs have the job type image-gen.

Here's an example of a image generation job response:

{
    "job_type": "image-gen",
    "job_id": "ig_90c7ebd5",
    "state": "success",
    "state_updated": "2023-06-29T16:28:31.317874",
    "state_running_start": "2023-06-29T16:27:39.284893",
    "state_running_end": "2023-06-29T16:28:31.317874",
    "state_queued_start": "2023-06-29T16:25:28.018608",
    "state_queued_end": "2023-06-29T16:27:39.284893",
    "queued_duration": 131.266285,
    "running_duration": 52.032981,
    "queueing_state": "default",
    "config": {
        "prompt": "portrait photo of ukj man, color, Martin Schoeller, serious eyes, perfect eyes, cinematic, 80mm portrait photography, dramatic lighting photography, national geographic, portrait, photo, photography, Stoic, cinematic, 4k, epic, detailed photograph, shot on kodak detailed, bokeh, cinematic, hbo, dark moody, volumetric fog",
        "negative_prompt": "nudity, amputee, bad anatomy, blurry, fuzzy, disfigured, misshaped, mutant, deformed, bad art, out of frame, off center",
        "width": 768,
        "height": 1024,
        "num_samples": 16,
        "checkpoint_id": "ckp_15f9112b",
        "model_type": "sd-v1",
        "base_model": null,
        "num_inference_steps": 20,
        "scheduler_type": "dpm++",
        "enable_hrf": true,
        "denoising_strength": 0.6,
        "seed": -1
    },
    "dreambooth_result": null,
    "image_gen_results": [
        {
            "checkpoint_id": "ckp_15f9112b",
            "config_idx": 0,
            "generated_images": [
                {
                    "generated_image_id": "c7102f3f",
                    "url": "https://storage.googleapis.com/nyxai-standard-usc2/images/generated_images/ig_90c7ebc5/ig_90c7ebc5_c7102f3f.png",
                    "seed": 2811570194,
                    "generation_idx": 0
                },
                {
                    "generated_image_id": "577ab3c6",
                    "url": "https://storage.googleapis.com/nyxai-standard-usc2/images/generated_images/ig_90c7ebc5/ig_90c7ebc5_577ab3c6.png",
                    "seed": 1587936907,
                    "generation_idx": 2
                },
                ...
            ]
        }
    ],
    "percentage_done": 100,
    "failure_reason": null,
    "failure_reason_data": null,
    "thumbnails": [
        "https://storage.googleapis.com/nyxai-public-usc2/images/thumbnails/ig_90c7ebc5/ig_90c7ebc5_c7102f3f_thumbnail.png",
        "https://storage.googleapis.com/nyxai-public-usc2/images/thumbnails/ig_90c7ebc5/ig_90c7ebc5_3ef6b3fc_thumbnail.png",
        "https://storage.googleapis.com/nyxai-public-usc2/images/thumbnails/ig_90c7ebc5/ig_90c7ebc5_732c4f70_thumbnail.png",
        "https://storage.googleapis.com/nyxai-public-usc2/images/thumbnails/ig_90c7ebc5/ig_90c7ebc5_93c5e4d0_thumbnail.png"
    ],
    "tags": []
}

Last updated