Installation
Install the AI Guardrails SDK for .NET to start calling Content Moderation API operations from your .NET application.
Prerequisites
Before you begin, ensure that you have:
An Alibaba Cloud account with Content Moderation activated
An AccessKey pair — see Configure credentials
.NET Framework 4.5 or later
.NET Standard 2.0 or later
C# 4.0 or later
Install the SDK
Download AI Guardrails SDK for .NET, then install the packages using one of the following methods.
Install using the .NET Core CLI
Run the following commands:
dotnet add package aliyun-net-sdk-core
dotnet add package aliyun-net-sdk-greenTo pin a specific version, append--version <version-number>to each command. For example:dotnet add package aliyun-net-sdk-core --version 1.0.0. Without a version flag, the latest version is installed.
Install using dotnet build
Add the following entries to your
.csprojfile:<PackageReference Include="aliyun-net-sdk-core" Version="1.5.10" /> <PackageReference Include="aliyun-net-sdk-green" Version="3.6.5" />Run the build command to install the packages:
dotnet build
Configure environment variables
Alibaba Cloud SDKs create default access credentials by reading the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables. When you call an API operation, the SDK reads your AccessKey pair from these credentials and completes authentication automatically. Before you use the SDK sample code, configure these environment variables. For more information, see Configure credentials.
What's next
After installation, use the SDK to call Content Moderation API operations. For code examples, see the AI Guardrails SDK for .NET README.