AIKernel.Providers.Flux 0.1.5

dotnet add package AIKernel.Providers.Flux --version 0.1.5
                    
NuGet\Install-Package AIKernel.Providers.Flux -Version 0.1.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AIKernel.Providers.Flux" Version="0.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AIKernel.Providers.Flux" Version="0.1.5" />
                    
Directory.Packages.props
<PackageReference Include="AIKernel.Providers.Flux" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AIKernel.Providers.Flux --version 0.1.5
                    
#r "nuget: AIKernel.Providers.Flux, 0.1.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AIKernel.Providers.Flux@0.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AIKernel.Providers.Flux&version=0.1.5
                    
Install as a Cake Addin
#tool nuget:?package=AIKernel.Providers.Flux&version=0.1.5
                    
Install as a Cake Tool

AIKernel FLUX.2 image editing provider

This independent provider edits an RGB24 reference image with a text instruction using FLUX.2 [klein] 4B. It targets .NET 10 with Windows x64 CPU execution. The original image provider can be used in the same application.

dotnet add package AIKernel.Providers.Flux --version 0.1.5
using AIKernel.Contracts.Images;
using AIKernel.Providers.Flux;

using var runtime = new FluxImageProvider(modelDirectory, privateSsdDirectory, weightCacheMiB: 256);
IImagePromptEditProvider editor = runtime;
ReadOnlyMemory<byte> edited = await editor.EditAsync(referenceRgb24, width, height,
    "Make the jacket blue and keep the original composition.", seed: 42, cancellationToken);

Pass consecutive rows of packed red, green, and blue bytes. Both dimensions must be multiples of 16 between 128 and 1024. The provider returns RGB24 of the same size. File codecs, UI, and routing belong to the application. The Windows release requires an AVX2-capable CPU and the Microsoft Visual C++ Redistributable.

Register the local model files

Keep the following three files in modelDirectory. The provider verifies their exact sizes and SHA-256 digests before inference. The weights are provisioned separately from the package.

Filename Source
flux-2-klein-4b-Q4_0.gguf leejet FLUX.2 klein 4B Q4_0
Qwen3-4B-Q4_K_M.gguf Qwen3 4B
flux2-vae.safetensors Save the 4B VAE diffusion_pytorch_model.safetensors under this name.

All three pinned weight sources identify their license as Apache-2.0. The accepted checkpoint is the distilled 4B variant.

ABI and memory

The provider calls ABI v1 of aikernel_flux.dll. The native tensor loader requests bytes through a callback. AIKernel VirtualMemorySpace owns the RAM cache, with checkpoint files on SSD as immutable backing. LastWeightStatistics reports resident cache bytes, successful native read requests, and logical reads from the checkpoint source. The budget applies to checkpoint pages. Native tensor staging, activations and decoder workspace have their own allocations. Native CUDA execution and GPU-resident pages require separate implementation and verification.

Build the native dependency

Use a Visual Studio x64 developer terminal with CMake and Ninja. Initialize the ggml submodule at the engine commit.

git clone https://github.com/leejet/stable-diffusion.cpp.git
git -C stable-diffusion.cpp checkout 0d71f963af9c94941f4a67e8ea145935651dd756
git -C stable-diffusion.cpp submodule update --init ggml
cmake -S native -B native-build -G Ninja -DCMAKE_BUILD_TYPE=Release -DAIKERNEL_FLUX_ENGINE="$((Resolve-Path stable-diffusion.cpp).Path)"
cmake --build native-build --parallel 4
dotnet pack AIKernel.Providers.Flux.csproj -c Release -p:FluxNativeLibrary="$((Resolve-Path native-build/aikernel_flux.dll).Path)"

The source build checks the engine and ggml revisions. CMake generates a translation unit with the tensor read redirected to the ABI. It leaves the pinned checkout untouched.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.5 97 11/23/2026

Initial FLUX.2 klein 4B CPU image editing provider for Windows x64.