StabilityAI 1.0.1-dev.15
dotnet add package StabilityAI --version 1.0.1-dev.15
NuGet\Install-Package StabilityAI -Version 1.0.1-dev.15
<PackageReference Include="StabilityAI" Version="1.0.1-dev.15" />
<PackageVersion Include="StabilityAI" Version="1.0.1-dev.15" />
<PackageReference Include="StabilityAI" />
paket add StabilityAI --version 1.0.1-dev.15
#r "nuget: StabilityAI, 1.0.1-dev.15"
#:package StabilityAI@1.0.1-dev.15
#addin nuget:?package=StabilityAI&version=1.0.1-dev.15&prerelease
#tool nuget:?package=StabilityAI&version=1.0.1-dev.15&prerelease
StabilityAI
Features 🔥
- Fully generated C# SDK based on official Stability AI OpenAPI specification using AutoSDK
- Same day update to support new features
- Updated and supported automatically if there are no breaking changes
- All modern .NET features - nullability, trimming, NativeAOT, etc.
- Support .Net Framework/.Net Standard 2.0
Usage
using StabilityAI;
using var client = new StabilityAIClient(apiKey);
List Engines
using var client = new StabilityAIClient(apiKey);
// Discover available engines before generating images
var engines = await client.V1Engines.ListEnginesAsync();
foreach (var engine in engines)
{
Console.WriteLine($"{engine.Id}: {engine.Name} ({engine.Type})");
Console.WriteLine($" {engine.Description}");
}
Text to Image
using var client = new StabilityAIClient(apiKey);
var images = await client.V1Generation.TextToImageAsync(
engineId: "stable-diffusion-v1-6",
request: new TextToImageRequestBody(
textToImageRequestBodyVariant1: new TextToImageRequestBodyVariant1
{
TextPrompts =
[
new TextPrompt
{
Text = "A beautiful sunset over mountains, digital art",
Weight = 1.0f,
},
],
Height = 512,
Width = 512,
},
generationOptionalParams: new GenerationRequestOptionalParams
{
Samples = 1,
}));
foreach (var image in images)
{
Console.WriteLine($"Seed: {image.Seed}, Finish reason: {image.FinishReason}");
// image.Base64 contains the generated image data
var bytes = Convert.FromBase64String(image.Base64!);
await File.WriteAllBytesAsync($"output_{image.Seed}.png", bytes);
}
Generate with Stable Diffusion 3.5
using var client = new StabilityAIClient(apiKey);
var response = await client.Generate.CreateStableImageGenerateSd3Async(
contentType: "multipart/form-data",
accept: CreateStableImageGenerateSd3Accept.ApplicationJson,
request: new CreateStableImageGenerateSd3Request
{
Prompt = "A crisp studio product photo of a ceramic espresso cup on a slate table",
Model = CreateStableImageGenerateSd3RequestModel.Sd35Large,
AspectRatio = CreateStableImageGenerateSd3RequestAspectRatio.x1_1,
OutputFormat = CreateStableImageGenerateSd3RequestOutputFormat.Png,
});
Console.WriteLine($"Seed: {response.Seed}");
Console.WriteLine($"Base64 bytes: {response.Image.Length}");
Image to Image
using var client = new StabilityAIClient(apiKey);
// Load the source image
var initImageBytes = await File.ReadAllBytesAsync("input.png");
var images = await client.V1Generation.ImageToImageAsync(
engineId: "stable-diffusion-v1-6",
request: new ImageToImageRequestBody
{
TextPrompts =
[
new TextPrompt
{
Text = "A fantasy castle on a cliff, dramatic lighting",
Weight = 1.0f,
},
],
InitImage = initImageBytes,
InitImagename = "input.png",
ImageStrength = 0.35f, // Lower = closer to original, higher = more creative
});
foreach (var image in images)
{
Console.WriteLine($"Seed: {image.Seed}, Finish reason: {image.FinishReason}");
var bytes = Convert.FromBase64String(image.Base64!);
await File.WriteAllBytesAsync($"output_{image.Seed}.png", bytes);
}
Upscale Image
using var client = new StabilityAIClient(apiKey);
// Load the image to upscale
var imageBytes = await File.ReadAllBytesAsync("low-res.png");
var images = await client.V1Generation.UpscaleImageAsync(
engineId: "esrgan-v1-x2plus",
request: new UpscaleImageRequestBody
{
Image = imageBytes,
Imagename = "low-res.png",
Width = 2048, // Only specify width OR height, not both
});
foreach (var image in images)
{
Console.WriteLine($"Seed: {image.Seed}, Finish reason: {image.FinishReason}");
var bytes = Convert.FromBase64String(image.Base64!);
await File.WriteAllBytesAsync("upscaled.png", bytes);
}
Masking
using var client = new StabilityAIClient(apiKey);
// Load the source image and mask image (must be same dimensions)
var initImageBytes = await File.ReadAllBytesAsync("input.png");
var maskImageBytes = await File.ReadAllBytesAsync("mask.png");
var images = await client.V1Generation.MaskingAsync(
engineId: "stable-diffusion-v1-6",
request: new MaskingRequestBody
{
TextPrompts =
[
new TextPrompt
{
Text = "A bright blue sky with fluffy clouds",
Weight = 1.0f,
},
],
InitImage = initImageBytes,
InitImagename = "input.png",
MaskImage = maskImageBytes,
MaskImagename = "mask.png",
});
foreach (var image in images)
{
Console.WriteLine($"Seed: {image.Seed}, Finish reason: {image.FinishReason}");
var bytes = Convert.FromBase64String(image.Base64!);
await File.WriteAllBytesAsync($"masked_{image.Seed}.png", bytes);
}
Ecosystem maintenance
This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.
Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.
Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.
Support
Priority place for bugs: https://github.com/tryAGI/StabilityAI/issues
Priority place for ideas and general questions: https://github.com/tryAGI/StabilityAI/discussions
Discord: https://discord.gg/Ca2xhfBf3v
Acknowledgments
This project is supported by JetBrains through the Open Source Support Program.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1-dev.15 | 84 | 9/2/2026 |
| 1.0.0 | 109 | 6/23/2026 |
| 0.0.0-dev.70 | 80 | 6/16/2026 |
| 0.0.0-dev.68 | 79 | 5/21/2026 |
| 0.0.0-dev.66 | 67 | 5/4/2026 |
| 0.0.0-dev.50 | 85 | 4/1/2026 |
| 0.0.0-dev.49 | 87 | 3/29/2026 |
| 0.0.0-dev.43 | 104 | 3/28/2026 |
| 0.0.0-dev.42 | 142 | 3/28/2026 |
| 0.0.0-dev.40 | 75 | 3/28/2026 |
| 0.0.0-dev.39 | 73 | 3/28/2026 |
| 0.0.0-dev.37 | 76 | 3/27/2026 |
| 0.0.0-dev.32 | 73 | 3/20/2026 |
| 0.0.0-dev.30 | 67 | 3/19/2026 |
| 0.0.0-dev.29 | 63 | 3/19/2026 |
| 0.0.0-dev.28 | 67 | 3/19/2026 |
| 0.0.0-dev.27 | 73 | 3/19/2026 |
| 0.0.0-dev.26 | 71 | 3/19/2026 |
| 0.0.0-dev.25 | 68 | 3/19/2026 |
| 0.0.0-dev.24 | 70 | 3/19/2026 |