All Products
Search
Document Center

AI Guardrails:Installation

Last Updated:Mar 31, 2026

Install the AI Guardrails API SDK for Python and configure credentials before making your first API call.

Prerequisites

Before you begin, ensure that you have:

  • Python 2.x or Python 3.x installed

  • pip installed on your server

To verify pip is available, run:

pip --version

If pip is not installed, use the command for your Linux distribution:

DistributionCommand
CentOS, Red Hat Enterprise Linuxyum -y install python3-pip
Ubuntu, Debianapt-get -y install python3-pip
openSUSE, SUSEzypper -n install python3-pip

Install the SDK

Before installing the SDK packages, download the Extension.Uploader utility class and import it into your project.

Then install the SDK packages for your Python version.

Python 2.x

pip install aliyun-python-sdk-core==2.13.10
pip install -v aliyun-python-sdk-green==3.6.6
pip install oss2

Python 3.x

pip install aliyun-python-sdk-core-v3==2.13.10
pip install -v aliyun-python-sdk-green==3.6.6
pip install oss2

Configure environment variables

The SDK reads your AccessKey pair from environment variables to authenticate API calls. Store credentials in environment variables rather than hardcoding them in source code.

Warning

Never include your AccessKey ID or AccessKey secret directly in code or commit them to version control. Use environment variables or a secrets manager to keep credentials secure.

Set the following environment variables:

export ALIBABA_CLOUD_ACCESS_KEY_ID='<your-access-key-id>'
export ALIBABA_CLOUD_ACCESS_KEY_SECRET='<your-access-key-secret>'

Replace the placeholders with your actual values:

PlaceholderDescription
<your-access-key-id>Your Alibaba Cloud AccessKey ID
<your-access-key-secret>Your Alibaba Cloud AccessKey secret

For more information on managing credentials, see Configure credentials.