Class ImageGenerationJobRequest
- Namespace
- CivitaiSharp.Sdk.Models.Jobs
- Assembly
- CivitaiSharp.Sdk.dll
Request model for image generation jobs. Supports both text-to-image and image-to-image modes.
public sealed class ImageGenerationJobRequest
- Inheritance
-
ImageGenerationJobRequest
- Inherited Members
Remarks
The job type is always "textToImage" for the Civitai API, regardless of whether source image is provided. When SourceImageUrl is provided, the generation operates in image-to-image mode.
Fields
JobType
The job type discriminator value for image generation jobs.
public const string JobType = "textToImage"
Field Value
Properties
AdditionalNetworks
Gets or sets additional networks (LoRAs, embeddings, etc.) to apply. Key is the AIR identifier, value is the network configuration.
[JsonPropertyName("additionalNetworks")]
public IReadOnlyDictionary<AirIdentifier, ImageJobNetworkParams>? AdditionalNetworks { get; init; }
Property Value
Air
Gets or sets the base AIR identifier. Required.
[JsonPropertyName("model")]
public required AirIdentifier Air { get; init; }
Property Value
Examples
urn:air:sdxl:checkpoint:civitai:4201@130072
Remarks
Note: The Civitai API uses "model" as the JSON property name, but this C# property is named "Air" to accurately reflect that it represents an AIR (Asset Identifier Resource) identifier, not a Model object. This distinction improves code clarity and type safety.
CallbackUrl
Gets or sets the webhook URL to call when the job completes.
[JsonPropertyName("callbackUrl")]
public string? CallbackUrl { get; init; }
Property Value
ClipSkip
Gets or sets the number of CLIP layers to skip. Range: 1-12.
[JsonPropertyName("clipSkip")]
public int? ClipSkip { get; init; }
Property Value
- int?
Remarks
This can also be set in ClipSkip.
ControlNets
Gets or sets ControlNet configurations for guided generation.
[JsonPropertyName("controlNets")]
public IReadOnlyList<ImageJobControlNet>? ControlNets { get; init; }
Property Value
DenoisingStrength
Gets or sets the denoising strength for image-to-image generation. Range: 0.0-1.0.
[JsonPropertyName("strength")]
public decimal? DenoisingStrength { get; init; }
Property Value
Remarks
Only applicable when SourceImageUrl is provided. Lower values (e.g., 0.3) preserve more of the source image. Higher values (e.g., 0.8) allow more transformation.
Params
Gets or sets the generation parameters. Required.
[JsonPropertyName("params")]
public required ImageJobParams Params { get; init; }
Property Value
Priority
Gets or sets the priority configuration for job scheduling.
[JsonPropertyName("priority")]
public Priority? Priority { get; init; }
Property Value
Properties
Gets or sets custom properties for job tracking and querying.
[JsonPropertyName("properties")]
public IReadOnlyDictionary<string, JsonElement>? Properties { get; init; }
Property Value
Remarks
Properties can contain any JSON-serializable values. Use JsonElement to preserve AOT compatibility while supporting arbitrary value types.
Quantity
Gets or sets the number of images to generate. Range: 1-10, default: 1.
[JsonPropertyName("quantity")]
public int? Quantity { get; init; }
Property Value
- int?
Retries
Gets or sets the number of automatic retries on failure. Default: 0.
[JsonPropertyName("retries")]
public int? Retries { get; init; }
Property Value
- int?
SourceImageUrl
Gets or sets the source image URL for image-to-image generation.
[JsonPropertyName("image")]
public string? SourceImageUrl { get; init; }
Property Value
Remarks
When provided, enables image-to-image mode where the source image is transformed according to the prompt and other parameters. Use DenoisingStrength to control how much the source image is transformed.
Timeout
Gets or sets the job timeout. Format: "HH:mm:ss". Default: "00:10:00".
[JsonPropertyName("timeout")]
public string? Timeout { get; init; }
Property Value
Type
Gets the job type discriminator. Always JobType.
[JsonPropertyName("$type")]
public string Type { get; init; }