Skip to main content

Python SDK

Discover the power of the Python SDK


The Python SDK is designed to streamline your AI workflows, making it easier than ever to interact with the Clarifai API. Whether you're building AI applications or integrating Clarifai into your existing systems, the Python SDK is your go-to tool for effortless API interaction.

With an intuitive, object-oriented approach, you can accelerate your AI development with just a few lines of code.

Installation

Install via PyPI

You can install the latest stable version of the Clarifai Python SDK using pip:

pip install -U clarifai

For additional functionality, you can install all the optional libraries mentioned here by running:

pip install "clarifai[all]"

Install from Source (for Development)

If you’re contributing to development or need the latest updates, install from source:

git clone https://github.com/Clarifai/clarifai-python.git
cd clarifai-python
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python setup.py install

Authentication

Clarifai uses Personal Access Tokens (PATs) to authenticate API requests. You can create and manage PATs in your Clarifai account security settings.

To set your PAT as an environment variable and use it with the Python SDK, run:

export CLARIFAI_PAT=YOUR_PAT_HERE