Table of Contents

Class ModelVersion

Namespace
CivitaiSharp.Core.Models
Assembly
CivitaiSharp.Core.dll

Represents a model version. When embedded in a Model response, some fields may be null. When fetched directly via /model-versions/:id, additional fields like Model and ModelId are populated.

public sealed record ModelVersion : IEquatable<ModelVersion>
Inheritance
ModelVersion
Implements
Inherited Members
Extension Methods

Constructors

ModelVersion(long, int?, long?, string, string, string?, string?, DateTime, DateTime?, DateTime?, string?, Availability?, int, string?, bool, IReadOnlyList<string>?, string?, JsonElement?, DateTime?, JsonElement?, string?, string?, string?, ModelVersionModel?, IReadOnlyList<ModelFile>?, IReadOnlyList<ModelVersionImage>?, ModelVersionStats?)

Represents a model version. When embedded in a Model response, some fields may be null. When fetched directly via /model-versions/:id, additional fields like Model and ModelId are populated.

public ModelVersion(long Id, int? Index, long? ModelId, string Name, string BaseModel, string? BaseModelType, string? Description, DateTime CreatedAt, DateTime? UpdatedAt, DateTime? PublishedAt, string? Status, Availability? Availability, int NsfwLevel, string? DownloadUrl, bool SupportsGeneration, IReadOnlyList<string>? TrainedWords, string? TrainingStatus, JsonElement? TrainingDetails, DateTime? EarlyAccessEndsAt, JsonElement? EarlyAccessConfig, string? UploadType, string? UsageControl, string? AirIdentifier, ModelVersionModel? Model, IReadOnlyList<ModelFile>? Files, IReadOnlyList<ModelVersionImage>? Images, ModelVersionStats? Stats)

Parameters

Id long

The unique identifier for the model version. Maps to JSON property "id".

Index int?

The index/order of this version among all versions of the parent model. Maps to JSON property "index".

ModelId long?

The unique identifier of the parent model. Maps to JSON property "modelId".

Name string

The name of the model version. Maps to JSON property "name".

BaseModel string

The base model this version was trained on (e.g., "SDXL 1.0", "SD 1.5", "Pony"). Maps to JSON property "baseModel".

BaseModelType string

The base model type classification. Maps to JSON property "baseModelType".

Description string

The description of the version, usually a changelog of updates. Maps to JSON property "description".

CreatedAt DateTime

The date and time when this version was created. Maps to JSON property "createdAt".

UpdatedAt DateTime?

The date and time when this version was last updated. Maps to JSON property "updatedAt".

PublishedAt DateTime?

The date and time when this version was published. Maps to JSON property "publishedAt".

Status string

The publication status of the version (e.g., "Published", "Draft"). Maps to JSON property "status".

Availability Availability?

The availability status of the version. Maps to JSON property "availability".

NsfwLevel int

The NSFW content level of the version on a numeric scale. Maps to JSON property "nsfwLevel".

DownloadUrl string

Direct download URL for this specific version. Maps to JSON property "downloadUrl".

SupportsGeneration bool

Indicates whether this version supports generation capabilities. Maps to JSON property "supportsGeneration".

TrainedWords IReadOnlyList<string>

Array of trigger words or phrases used to activate this model in generation. Maps to JSON property "trainedWords".

TrainingStatus string

The status of any ongoing training job for this version. Maps to JSON property "trainingStatus".

TrainingDetails JsonElement?

Detailed metadata about the training process if applicable. Maps to JSON property "trainingDetails".

This property uses JsonElement because the Civitai API returns highly variable structures for training details depending on the training workflow. The JSON structure is not documented by the API, nor is the data consistent. Use TryGetProperty(string, out JsonElement) to safely access nested values.

EarlyAccessEndsAt DateTime?

The date and time when early access restrictions end for this version. Maps to JSON property "earlyAccessEndsAt".

EarlyAccessConfig JsonElement?

Configuration settings for early access restrictions. Maps to JSON property "earlyAccessConfig".

This property uses JsonElement because the Civitai API returns highly variable structures for early access configuration. The JSON structure is not documented by the API, nor is the data consistent. Use TryGetProperty(string, out JsonElement) to safely access nested values.

UploadType string

The method by which this version was uploaded (e.g., "Created", "Imported"). Maps to JSON property "uploadType".

UsageControl string

The usage control type for this version (e.g., "Download"). Maps to JSON property "usageControl".

AirIdentifier string

The AIR artifact identifier for this version. Maps to JSON property "air".

Model ModelVersionModel

Abbreviated information about the parent model. Maps to JSON property "model".

Files IReadOnlyList<ModelFile>

List of files included in this model version. Maps to JSON property "files".

Images IReadOnlyList<ModelVersionImage>

Gallery images showcasing example outputs from this model version. Maps to JSON property "images".

Stats ModelVersionStats

Statistical information about user interactions with this model version. Maps to JSON property "stats".

Properties

AirIdentifier

The AIR artifact identifier for this version. Maps to JSON property "air".

[JsonPropertyName("air")]
public string? AirIdentifier { get; init; }

Property Value

string

Availability

The availability status of the version. Maps to JSON property "availability".

[JsonPropertyName("availability")]
public Availability? Availability { get; init; }

Property Value

Availability?

BaseModel

The base model this version was trained on (e.g., "SDXL 1.0", "SD 1.5", "Pony"). Maps to JSON property "baseModel".

[JsonPropertyName("baseModel")]
public string BaseModel { get; init; }

Property Value

string

BaseModelType

The base model type classification. Maps to JSON property "baseModelType".

[JsonPropertyName("baseModelType")]
public string? BaseModelType { get; init; }

Property Value

string

CreatedAt

The date and time when this version was created. Maps to JSON property "createdAt".

[JsonPropertyName("createdAt")]
public DateTime CreatedAt { get; init; }

Property Value

DateTime

Description

The description of the version, usually a changelog of updates. Maps to JSON property "description".

[JsonPropertyName("description")]
public string? Description { get; init; }

Property Value

string

DownloadUrl

Direct download URL for this specific version. Maps to JSON property "downloadUrl".

[JsonPropertyName("downloadUrl")]
public string? DownloadUrl { get; init; }

Property Value

string

EarlyAccessConfig

Configuration settings for early access restrictions. Maps to JSON property "earlyAccessConfig".

This property uses JsonElement because the Civitai API returns highly variable structures for early access configuration. The JSON structure is not documented by the API, nor is the data consistent. Use TryGetProperty(string, out JsonElement) to safely access nested values.

[JsonPropertyName("earlyAccessConfig")]
public JsonElement? EarlyAccessConfig { get; init; }

Property Value

JsonElement?

EarlyAccessEndsAt

The date and time when early access restrictions end for this version. Maps to JSON property "earlyAccessEndsAt".

[JsonPropertyName("earlyAccessEndsAt")]
public DateTime? EarlyAccessEndsAt { get; init; }

Property Value

DateTime?

Files

List of files included in this model version. Maps to JSON property "files".

[JsonPropertyName("files")]
public IReadOnlyList<ModelFile>? Files { get; init; }

Property Value

IReadOnlyList<ModelFile>

Id

The unique identifier for the model version. Maps to JSON property "id".

[JsonPropertyName("id")]
public long Id { get; init; }

Property Value

long

Images

Gallery images showcasing example outputs from this model version. Maps to JSON property "images".

[JsonPropertyName("images")]
public IReadOnlyList<ModelVersionImage>? Images { get; init; }

Property Value

IReadOnlyList<ModelVersionImage>

Index

The index/order of this version among all versions of the parent model. Maps to JSON property "index".

[JsonPropertyName("index")]
public int? Index { get; init; }

Property Value

int?

Model

Abbreviated information about the parent model. Maps to JSON property "model".

[JsonPropertyName("model")]
public ModelVersionModel? Model { get; init; }

Property Value

ModelVersionModel

ModelId

The unique identifier of the parent model. Maps to JSON property "modelId".

[JsonPropertyName("modelId")]
public long? ModelId { get; init; }

Property Value

long?

Name

The name of the model version. Maps to JSON property "name".

[JsonPropertyName("name")]
public string Name { get; init; }

Property Value

string

NsfwLevel

The NSFW content level of the version on a numeric scale. Maps to JSON property "nsfwLevel".

[JsonPropertyName("nsfwLevel")]
public int NsfwLevel { get; init; }

Property Value

int

PublishedAt

The date and time when this version was published. Maps to JSON property "publishedAt".

[JsonPropertyName("publishedAt")]
public DateTime? PublishedAt { get; init; }

Property Value

DateTime?

Stats

Statistical information about user interactions with this model version. Maps to JSON property "stats".

[JsonPropertyName("stats")]
public ModelVersionStats? Stats { get; init; }

Property Value

ModelVersionStats

Status

The publication status of the version (e.g., "Published", "Draft"). Maps to JSON property "status".

[JsonPropertyName("status")]
public string? Status { get; init; }

Property Value

string

SupportsGeneration

Indicates whether this version supports generation capabilities. Maps to JSON property "supportsGeneration".

[JsonPropertyName("supportsGeneration")]
public bool SupportsGeneration { get; init; }

Property Value

bool

TrainedWords

Array of trigger words or phrases used to activate this model in generation. Maps to JSON property "trainedWords".

[JsonPropertyName("trainedWords")]
public IReadOnlyList<string>? TrainedWords { get; init; }

Property Value

IReadOnlyList<string>

TrainingDetails

Detailed metadata about the training process if applicable. Maps to JSON property "trainingDetails".

This property uses JsonElement because the Civitai API returns highly variable structures for training details depending on the training workflow. The JSON structure is not documented by the API, nor is the data consistent. Use TryGetProperty(string, out JsonElement) to safely access nested values.

[JsonPropertyName("trainingDetails")]
public JsonElement? TrainingDetails { get; init; }

Property Value

JsonElement?

TrainingStatus

The status of any ongoing training job for this version. Maps to JSON property "trainingStatus".

[JsonPropertyName("trainingStatus")]
public string? TrainingStatus { get; init; }

Property Value

string

UpdatedAt

The date and time when this version was last updated. Maps to JSON property "updatedAt".

[JsonPropertyName("updatedAt")]
public DateTime? UpdatedAt { get; init; }

Property Value

DateTime?

UploadType

The method by which this version was uploaded (e.g., "Created", "Imported"). Maps to JSON property "uploadType".

[JsonPropertyName("uploadType")]
public string? UploadType { get; init; }

Property Value

string

UsageControl

The usage control type for this version (e.g., "Download"). Maps to JSON property "usageControl".

[JsonPropertyName("usageControl")]
public string? UsageControl { get; init; }

Property Value

string