Skip to main content

📦 ibm-watsonx-ai

Official IBM watsonx.ai Python SDK


IBM Python License

PyPI Downloads Docs Examples


Enterprise-grade Python client for building, tuning and deploying AI models with IBM watsonx.ai

🚀 Quick Start • 📘 Documentation • 📓 Examples

📌 Overview

ibm-watsonx-ai is the official Python SDK for IBM watsonx.ai, an enterprise-grade AI platform for building, training, tuning, deploying, and operating AI models at scale.

The SDK provides a unified and production-ready Python interface to the full watsonx.ai ecosystem, including Foundation Models (within LLMs), AutoAI experiments, Retrieval-Augmented Generation (RAG), model tuning, deployment, and data integration.

With ibm-watsonx-ai, developers and data scientists can seamlessly integrate advanced AI capabilities into Python applications running on IBM watsonx.ai for IBM Cloud or IBM watsonx.ai software, while meeting enterprise requirements such as security, governance, and scalability.


🎯 What This SDK Is Used For

The ibm-watsonx-ai SDK is designed to support the entire AI lifecycle:

  • 🔐 Secure authentication and environment configuration
  • 🤖 Inference with Foundation Models (LLMs, embeddings, time-series, audio)
  • 📚 Building Retrieval-Augmented Generation (RAG) systems
  • 🧪 Running and optimizing AutoAI experiments
  • ⚙️ Fine-tuning and prompt tuning of models
  • 🚀 Deploying models to scalable inference endpoints
  • 🔗 Integrating enterprise data sources into AI workflows

It is suitable for research, prototyping, and production deployments.


📦 Installation

Install from PyPI:

pip install ibm-watsonx-ai

Install with optional extras:

pip install "ibm-watsonx-ai[rag]"
Extra Description
rag Retrieval‑Augmented Generation utilities
mcp Model Context Protocol

🚀 Quick Start

Authentication

Set up your Credentials and create an APIClient instance:

from ibm_watsonx_ai import Credentials, APIClient

credentials = Credentials(
    url="https://us-south.ml.cloud.ibm.com",
    api_key="<your-ibm-api-key>"
)

# Initialize APIClient using a space ID (you can also use a project ID)
api_client = APIClient(credentials, space_id="<your-space-id>")

Working with ModelInference

List available chat models

list(api_client.foundation_models.ChatModels)

# Output example:
# [<ChatModels.GRANITE_3_3_8B_INSTRUCT: 'ibm/granite-3-3-8b-instruct'>,
#  <ChatModels.GRANITE_4_H_SMALL: 'ibm/granite-4-h-small'>,
#  <ChatModels.LLAMA_3_3_70B_INSTRUCT: 'meta-llama/llama-3-3-70b-instruct'>,
#  <ChatModels.GPT_OSS_120B: 'openai/gpt-oss-120b'>]

Initialize ModelInference

from ibm_watsonx_ai.foundation_models import ModelInference

# Create a `ModelInference` instance for the selected model
model = ModelInference(
    api_client=api_client,
    model_id="ibm/granite-4-h-small"
)

Chat with the model

# Prepare messages
messages = [
    {"role": "system", "content": "You are a helpful assistant that translates English to French."},
    {"role": "user", "content": "I love you for listening to Rock."}
]

# Get model response
response = model.chat(messages=messages)
print(response)

Metadata

Release files for ibm-watsonx-ai 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ibm-watsonx-ai 1.9.0
File Size Uploaded Provenance Actions
ibm_watsonx_ai-1.9.0.tar.gz 743.7 kB Without provenance Details for ibm_watsonx_ai-1.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ibm-watsonx-ai 1.9.0
File Interpreter ABI Platform Actions
ibm_watsonx_ai-1.9.0-py3-none-any.whl Python 3 none any Details for ibm_watsonx_ai-1.9.0-py3-none-any.whl

Total release size: 1.9 MB

Release files / ibm_watsonx_ai-1.9.0.tar.gz

Download URL ibm_watsonx_ai-1.9.0.tar.gz
Size 743.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fcffec8f7c007a10b6ff9e96fbedcc8741b34b178fb3b7de90ae789859f97faf
BLAKE2b-256 checksum
How to use checksums
c1aefaaaaeaa58df6c41521f96bb775e2fe438e9ec36c81fe1bab40b03580ad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / ibm_watsonx_ai-1.9.0-py3-none-any.whl

Download URL ibm_watsonx_ai-1.9.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a49a35aecbd61c353a372733de7954ca01d0697e4751e4f1ed8149e7430d37e0
BLAKE2b-256 checksum
How to use checksums
4fb01705313ceb89b4c71089517c8dd6d4858fb7f97ae36d293c78804b9153ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for ibm-watsonx-ai 1.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.9.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page