Soenneker.OpenAI.Moderation 11.0.136

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.OpenAI.Moderation --version 11.0.136
                    
NuGet\Install-Package Soenneker.OpenAI.Moderation -Version 11.0.136
                    
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="Soenneker.OpenAI.Moderation" Version="11.0.136" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.OpenAI.Moderation" Version="11.0.136" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.OpenAI.Moderation" />
                    
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 Soenneker.OpenAI.Moderation --version 11.0.136
                    
#r "nuget: Soenneker.OpenAI.Moderation, 11.0.136"
                    
#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 Soenneker.OpenAI.Moderation@11.0.136
                    
#: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=Soenneker.OpenAI.Moderation&version=11.0.136
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.OpenAI.Moderation&version=11.0.136
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.OpenAI.Moderation

Moderate text with OpenAI and inspect flagged categories through typed response helpers.

Installation

dotnet add package Soenneker.OpenAI.Moderation

Registration and configuration

Register the scoped utility during application startup:

using Soenneker.OpenAI.Moderation.Registrars;

services.AddOpenAIModerationUtilAsScoped();

The scoped registration keeps the utility scoped while reusing the singleton OpenAI client. A singleton utility registration is also available through AddOpenAIModerationUtilAsSingleton().

Provide the API key through configuration. Enabled defaults to true, and Model defaults to omni-moderation-latest when omitted:

{
  "OpenAI": {
    "ApiKey": "...",
    "Moderation": {
      "Enabled": true,
      "Model": "omni-moderation-latest"
    }
  }
}

Keep the API key in a secret store or environment variable rather than committed configuration.

Moderate text

Inject IOpenAIModerationUtil, then inspect the returned OpenAI response directly or use the supplied helpers:

using Soenneker.OpenAI.Moderation.Abstract;
using Soenneker.OpenAI.Moderation.Extensions;
using Soenneker.OpenAI.OpenApiClient.Models;

CreateModerationResponse? response = await moderationUtil.Moderate("content to check", cancellationToken);

if (response.IsFlagged())
{
    IReadOnlyList<string> categories = response.GetFlaggedCategoryValues();
}

Moderate returns null when moderation is disabled, the input is empty, or every item in a batch is blank. API and transport failures are allowed to propagate to the caller.

Moderate several inputs in one request:

CreateModerationResponse? response = await moderationUtil.Moderate(
    ["first message", "second message"],
    cancellationToken);

Use per-call options when behavior should differ from configuration:

var options = new OpenAIModerationOptions
{
    Enabled = true,
    Model = "omni-moderation-latest"
};

CreateModerationResponse? response = await moderationUtil.Moderate(
    "content to check",
    options,
    cancellationToken);
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.150 145 11/19/2026
11.0.149 75 11/19/2026
11.0.148 69 11/19/2026
11.0.147 80 11/18/2026
11.0.145 85 11/17/2026
11.0.144 72 11/17/2026
11.0.143 98 11/15/2026
11.0.142 89 11/15/2026
11.0.141 184 11/11/2026
11.0.140 96 11/11/2026
11.0.138 107 11/11/2026
11.0.137 84 11/11/2026
11.0.136 99 11/11/2026
11.0.135 203 11/6/2026
11.0.134 115 11/5/2026
11.0.133 149 11/3/2026
11.0.132 101 11/3/2026
11.0.131 92 11/3/2026
11.0.130 95 11/3/2026
11.0.129 88 11/3/2026
Loading failed

Upgrade .NET 11 release candidates to stable