Skip to content

SDXL image generation

SDXL is Stable Diffusion XL — the higher-resolution successor to SD1. Native resolution 1024×1024, massive community catalog, prompt style sits between SD1's Booru tags and Flux's natural language (tags still help; full sentences work too). Two invocation paths on the orchestrator:

engineBest forNotes
sdcpp (ecosystem sdxl)Default — Stable Diffusion C++ on Civitai workerssampleMethod + schedule sdcpp enums, textual-inversion embeddings, uCache mode.
comfy (ecosystem sdxl)When you specifically need ComfyUI sampler/scheduler enums or a Comfy-only featuresampler + scheduler Comfy enums, denoiseStrength (vs sdcpp's strength) on variants.

Default choice for new integrations: engine: "sdcpp", ecosystem: "sdxl". Reach for comfy only when you specifically need a ComfyUI-exclusive sampler (dpmpp_2m, dpmpp_sde, etc.) or scheduler (karras).

Both engines support createImage and createVariant (img2img). Neither supports editImage — use Flux 1 Kontext or Flux 2 Klein if you need prompt-driven editing.

Prerequisites

sdcpp (default path)

Text-to-image

http
POST https://orchestration.civitai.com/v2/consumer/workflows?wait=60
Authorization: Bearer <your-token>
Content-Type: application/json

{
  "steps": [{
    "$type": "imageGen",
    "input": {
      "engine": "sdcpp",
      "ecosystem": "sdxl",
      "operation": "createImage",
      "model": "urn:air:sdxl:checkpoint:civitai:101055@128078",
      "prompt": "masterpiece, best quality, 1girl, solo, landscape, sunset, cinematic lighting, highly detailed",
      "negativePrompt": "worst quality, low quality, blurry",
      "width": 1024,
      "height": 1024,
      "cfgScale": 7,
      "steps": 25
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

Common sdcpp-sdxl parameters:

FieldDefaultRangeNotes
model— ✅AIR URNSDXL checkpoint. See the catalog.
prompt— ✅≤ 10 000 charsTag-style or natural language. Quality tags (masterpiece, best quality, …) still help.
negativePrompt(none)≤ 10 000 charsRecommended. worst quality, low quality, blurry is a solid starting point.
width / height1024642048, divisible by 16SDXL's native resolution is 1024×1024. Well-behaved aspect ratios: 1024×1024, 1152×896, 896×1152, 1216×832, 832×1216, 1344×768, 768×1344, 1536×640, 640×1536.
cfgScale703068 works for most SDXL checkpoints; LCM/Turbo variants want 12.
steps2011502030 typical. LCM/Turbo checkpoints need fewer (48).
sampleMethodeulerenumSdCppSampleMethod.
schedulediscreteenumSdCppSchedule.
vaeModel(checkpoint VAE)AIR URNOverride baked-in VAE. Rarely needed.
loras{}{ airUrn: strength }Stack multiple; 0.61.0 strengths typical.
embeddings[]array of AIR URNsTextual inversions. Reference them in the prompt / negative prompt by their embedding name.
quantity1112Number of images per call.
seedrandomint64Pin for reproducibility.
uCache(default)enumSdCppUCacheMode. Caching strategy; leave default unless you know you want otherwise.

No clipSkip on SDXL

Unlike SD1, SDXL doesn't expose a clipSkip parameter — the model's dual text encoders make the SD1 clip-skip convention meaningless here. Sending clipSkip on an SDXL request will 400.

Aspect-ratio variants

SDXL handles off-square aspect ratios well as long as you stay near ~1 megapixel total area. Go too wide or too tall and composition artifacts (duplicated subjects, "mirrored twin" effects) start to appear.

json
{
  "steps": [{
    "$type": "imageGen",
    "input": {
      "engine": "sdcpp",
      "ecosystem": "sdxl",
      "operation": "createImage",
      "model": "urn:air:sdxl:checkpoint:civitai:101055@128078",
      "prompt": "masterpiece, best quality, wide panoramic view of a futuristic city at dusk",
      "negativePrompt": "worst quality, low quality",
      "width": 1536,
      "height": 640,
      "cfgScale": 7,
      "steps": 25
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

With LoRAs

json
{
  "steps": [{
    "$type": "imageGen",
    "input": {
      "engine": "sdcpp",
      "ecosystem": "sdxl",
      "operation": "createImage",
      "model": "urn:air:sdxl:checkpoint:civitai:101055@128078",
      "prompt": "masterpiece, best quality, portrait of a warrior in ornate armor",
      "negativePrompt": "worst quality, low quality, blurry",
      "width": 1024,
      "height": 1024,
      "cfgScale": 7,
      "steps": 25,
      "loras": {
        "urn:air:sdxl:lora:civitai:123456@789012": 0.8
      }
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

Image-to-image (createVariant)

json
{
  "steps": [{
    "$type": "imageGen",
    "input": {
      "engine": "sdcpp",
      "ecosystem": "sdxl",
      "operation": "createVariant",
      "model": "urn:air:sdxl:checkpoint:civitai:101055@128078",
      "prompt": "masterpiece, best quality, daytime with clear blue sky",
      "negativePrompt": "worst quality, low quality",
      "width": 1024,
      "height": 1024,
      "cfgScale": 7,
      "steps": 25,
      "image": "https://image.civitai.com/.../source.jpeg",
      "strength": 0.7
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

strength controls how much of the source to preserve — 0.0 returns the source unchanged, 1.0 discards it entirely. 0.60.8 is the sweet spot for "keep composition, change style". Note image is a plain string URL (not a { url: ... } wrapper), and the field is strength (not denoiseStrength like on Comfy).

Comfy (alternative path)

Use engine: "comfy" when you need a ComfyUI-specific sampler — dpmpp_2m paired with the karras scheduler is a popular combo on SDXL for smoother detail:

json
{
  "steps": [{
    "$type": "imageGen",
    "input": {
      "engine": "comfy",
      "ecosystem": "sdxl",
      "operation": "createImage",
      "model": "urn:air:sdxl:checkpoint:civitai:101055@128078",
      "prompt": "masterpiece, best quality, 1girl, solo, landscape, sunset, cinematic lighting",
      "negativePrompt": "worst quality, low quality, blurry",
      "width": 1024,
      "height": 1024,
      "steps": 30,
      "cfgScale": 7,
      "sampler": "dpmpp_2m",
      "scheduler": "karras"
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

Key differences from sdcpp:

Fieldsdcppcomfy
SamplersampleMethod (SdCppSampleMethod)sampler (ComfySampler)
Scheduleschedule (SdCppSchedule)scheduler (ComfyScheduler)
Img2img strengthstrength (default 0.7)denoiseStrength (default 0.75)
Default steps2030
embeddings array
uCache

Comfy also supports createVariant with image (plain string URL) + denoiseStrength; see the ComfySdxlVariantImageGenInput schema.

Reading the result

Both engines emit the standard imageGen output — an images[] array, one entry per quantity:

json
{
  "status": "succeeded",
  "steps": [{
    "name": "0",
    "$type": "imageGen",
    "status": "succeeded",
    "output": {
      "images": [
        { "id": "blob_...", "url": "https://.../signed.jpeg" }
      ]
    }
  }]
}

Blob URLs are signed and expire — refetch the workflow or call GetBlob for a fresh URL.

Runtime

SDXL at 1024×1024 typically finishes in 10–25 s (sdcpp) or 15–35 s (comfy). wait=60 works comfortably for quantity ≤ 2. LCM/Turbo checkpoints at steps: 48 finish in 3–8 s and support higher quantity inside the same window. For larger batches or atypical aspect ratios, submit with wait=0 and poll.

Cost

Billed in Buzz on the workflow's transactions. Use whatif=true for an exact preview; see Payments (Buzz) for currency selection.

Both engines use the same per-pixel / per-step shape — different reference values:

total = base × (width × height / referencePixels) × (steps / referenceSteps) × quantity
PathbasereferencePixelsreferenceStepsDefaults → Buzz
sdcpp + sdxl81024²201024²/steps: 20/q: 1~8 Buzz
comfy + sdxl81024²301024²/steps: 30/q: 1~8 Buzz

Examples:

  • 1024² at quantity: 4 → ~32 Buzz
  • 1344×768 at steps: 25 → ~8 × 0.98 × 1.25 ≈ ~10 Buzz (sdcpp)
  • 1024² at steps: 35~14 Buzz (sdcpp)
  • 1536×640 at steps: 25 → ~8 × 0.94 × 1.25 ≈ ~9 Buzz (sdcpp)

Atypical aspect ratios still bill by total pixel area, so a 2:1 panorama at the same megapixel count costs the same as a 1:1 image at 1024².

Troubleshooting

SymptomLikely causeFix
400 with "model must match AIR pattern"Passed a bare model ID or version slugUse a full AIR URN: urn:air:sdxl:checkpoint:civitai:<modelId>@<versionId>.
400 with "clipSkip is not a valid property" on SDXLclipSkip doesn't exist on SDXL (it's an SD1 knob)Remove the field. SDXL uses dual text encoders; there's nothing to skip.
400 with unknown propertyField not valid for this engine (e.g. sampler on sdcpp, sampleMethod on comfy, denoiseStrength on sdcpp)Match the schema for your chosen engine — see the difference table above.
Output has duplicated subjects / mirrored-twin compositionAspect ratio too far from 1:1 at fixed megapixel countStick to well-behaved SDXL ratios: 1024², 1152×896, 1344×768, 1536×640, and mirrors thereof.
Turbo/LCM checkpoint produces mushcfgScale / steps tuned for base SDXLTurbo/LCM want cfgScale: 12 and steps: 48.
LoRA has no visible effectWrong AIR URN, model private / not published, or ecosystem mismatchVerify the URN on the LoRA's Civitai page; only SDXL-tagged LoRAs work on the sdxl ecosystem.
Request timed out (wait expired)Large quantity, atypical dimensions, busy workerResubmit with wait=0 and poll.
Step failed, reason = "blocked"Prompt hit content moderationDon't retry the same input — see Errors & retries → Step-level failures.
  • SubmitWorkflow — operation used by every example here
  • GetWorkflow — for polling
  • SD1 image generation — the 512×512 predecessor with the same two-engine pattern
  • Flux 2 / Flux 1 image generation — newer families with stronger prompt adherence
  • Image upscaling — chain after imageGen for higher-res output
  • Prompt enhancement — LLM-rewrite a prompt before feeding it in via $ref (use ecosystem: "sdxl" on the enhancer)
  • Full parameter catalog: the SdxlCreateImageGenInput / SdxlVariantImageGenInput / ComfySdxlCreateImageGenInput / ComfySdxlVariantImageGenInput schemas in the API reference
  • imageGen endpoint OpenAPI spec — standalone OpenAPI 3.1 YAML covering the full imageGen surface; import into Postman / OpenAPI Generator

Civitai Developer Documentation