Install the AI Guardrails SDK for Go and configure your credentials to start calling Content Moderation APIs.
Prerequisites
Go 1.10.0 or later is required. Verify your current version:
go versionInstall the SDK
Download the AI Guardrails SDK for Go.
Run the following command to install AI Guardrails SDK for Go:
go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdkAdd the SDK import path to your source file:
import "github.com/aliyun/alibaba-cloud-sdk-go/services/green"
Configure environment variables
The SDK reads your AccessKey pair from two environment variables: ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET. Set these before running any SDK code.
Linux/macOS:
export ALIBABA_CLOUD_ACCESS_KEY_ID=<your-access-key-id>
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your-access-key-secret>Windows (Command Prompt):
set ALIBABA_CLOUD_ACCESS_KEY_ID=<your-access-key-id>
set ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your-access-key-secret>For other credential types (RAM roles, STS tokens), see Configure credentials.