How to use SDXL 1.0 with Omniinfer API

TIP

  • Some of the Sampler(DDIM,PLMS,UniPC) may not be supported by SDXL 1.0
  • ControlNet not supported by SDXL 1.0
  • Images size should be 1024*1024

If you encounter any issues during usage, feel free to ask questions through our official Discord channel: omniinfer offical discord channelopen in new window. We are here to assist you!

1. Create Your Account

In case you haven't registered for a OmniInfer account yet, you can easily create one by visiting this link: - https://omniinfer.io/user/loginopen in new window.

At present, we exclusively offer Google login and github login authentication method. And we have plans to incorporate additional login options in the future.

2. Create an API key

When you log in, we will create a key for you by default. Click Hereopen in new window. Key image You can create your own key with the Add new key

3. Top up your account

In your account dashboard, you will see a Credit section. We give each logged-in user 50 free chances to generate a picture. Hereopen in new window you will find the historical usage data of your account: Account To top up your account: Hereopen in new windowBilling

4. Use the API

You are now ready to create your initial API request using the programming language of your choice.

4.1 Endpoint

The base API endpoint you will be using is: https://api.omniinfer.io/

4.2 Authentication

To authenticate your API request, include the key parameter in the HTTP headers. This parameter will serve as your authentication key.

X-Omni-Key: YOUR-KEY

4.3 Request SDXL 1.0

Please set the Content-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.

"model_name": "sd_xl_base_1.0.safetensors" in Request parameter represent SDXL 1.0

Request:

curl --location --request POST 'http://api.omniinfer.io/v2/txt2img' \
--header 'User-Agent: Apifox/1.0.0 (https://www.apifox.cn)' \
--header 'Content-Type: application/json' \
--header 'X-Omni-Key: ${your Key in step 2}' \
--data-raw '{
  "prompt": "fantastic,Best quality, masterpiece, ultra high res, (photorealistic:1.4), raw photo, 1girl, offshoulder, in the dark, deep shadow",
  "negative_prompt": "nsfw,ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), watermark",
  "sampler_name": "DPM++ SDE Karras",
  "batch_size": 1,
  "n_iter": 1,
  "steps": 20,
  "cfg_scale": 7,
  "seed": -1,
  "height": 1024,
  "width": 1024,
  "model_name": "sd_xl_base_1.0.safetensors"
}'

Response:

{
    "code": 0,
    "msg": "",
    "data": {
        "task_id": "bec2bcfe-47c6-4536-af34-f26cfe6fd457"
    }
}

4.4 Use task_id to get images

HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.

You can get images url in imgs of response.

Request:

curl --location --request GET 'http://api.omniinfer.io/v2/progress?task_id=d6a4e2bb-476d-49b5-bbb0-62eac05ff9b4' \
--header 'User-Agent: Apifox/1.0.0 (https://www.apifox.cn)' \
--header 'X-Omni-Key: ${your Key in step 2}'

Response:

{
    "code": 0,
    "msg": "",
    "data": {
        "status": 2,
        "progress": 1,
        "eta_relative": 0,
        "imgs": [
            "https://stars-test.s3.amazonaws.com/free-prod/bec2bcfe-47c6-4536-af34-f26cfe6fd457-0.png"
        ],
        "info": "{\"prompt\": \"Best quality, masterpiece, ultra high res, (photorealistic:1.4), raw photo, 1girl, offshoulder, in the dark, deep shadow\", \"all_prompts\": [\"Best quality, masterpiece, ultra high res, (photorealistic:1.4), raw photo, 1girl, offshoulder, in the dark, deep shadow\"], \"negative_prompt\": \"nsfw,ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), watermark\", \"all_negative_prompts\": [\"nsfw,ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), watermark\"], \"seed\": 4204593425, \"all_seeds\": [4204593425], \"subseed\": 332111771, \"all_subseeds\": [332111771], \"subseed_strength\": 0, \"width\": 1024, \"height\": 1024, \"sampler_name\": \"DPM++ SDE Karras\", \"cfg_scale\": 7.0, \"steps\": 20, \"batch_size\": 1, \"restore_faces\": false, \"face_restoration_model\": null, \"sd_model_hash\": \"1f69731261\", \"seed_resize_from_w\": -1, \"seed_resize_from_h\": -1, \"denoising_strength\": 0, \"extra_generation_params\": {}, \"index_of_first_image\": 0, \"infotexts\": [\"Best quality, masterpiece, ultra high res, (photorealistic:1.4), raw photo, 1girl, offshoulder, in the dark, deep shadow\\nNegative prompt: nsfw,ng_deepnegative_v1_75t, badhandv4, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), watermark\\nSteps: 20, Sampler: DPM++ SDE Karras, CFG scale: 7.0, Seed: 4204593425, Size: 1024x1024, Model hash: 1f69731261, Model: sd_xl_base_0.9, Denoising strength: 0, Version: v1.5.0-RC\"], \"styles\": [], \"job_timestamp\": \"20230726100311\", \"clip_skip\": 1, \"is_using_inpainting_conditioning\": false}",
        "failed_reason": "",
        "current_images": null,
        "submit_time": "2023-07-26 18:03:11",
        "execution_time": "2023-07-26 18:03:11",
        "txt2img_time": "2023-07-26 18:03:27",
        "finish_time": "2023-07-26 18:03:27"
    }
}

4.5 SDXL 1.0 images showcases

SDXL 1.0

TIP

Welcome to join our official Discord channel: omniinfer offical discord channelopen in new window. We are here watting for you!