IBM watsonx.ai for IBM Cloud

Requirements

For information on how to start working with IBM watsonx.ai for IBM Cloud, refer to Getting started with Cloud Pak for Data as a Service.

Supported machine learning frameworks

For a list of supported machine learning frameworks (models) on IBM watsonx.ai for IBM Cloud, refer to Supported frameworks and software specifications.

Authentication

To use watsonx.ai APIs, create an instance of APIClient with authentication details.

Note: Depending on the region of your provisioned service instance, use one of the following as your URL:

  • Dallas: https://us-south.ml.cloud.ibm.com

  • London: https://eu-gb.ml.cloud.ibm.com

  • Frankfurt: https://eu-de.ml.cloud.ibm.com

  • Tokyo: https://jp-tok.ml.cloud.ibm.com

Note: To determine your api_key, refer to IBM Cloud console API keys.

Example of creating the client using an API key:

from ibm_watsonx_ai import APIClient
from ibm_watsonx_ai import Credentials

credentials = Credentials(
                   url = "https://us-south.ml.cloud.ibm.com",
                   api_key = "***********"
                  )

client = APIClient(credentials)

Example of creating the client using a token:

from ibm_watsonx_ai import APIClient
from ibm_watsonx_ai import Credentials

credentials = Credentials(
                   url = "https://us-south.ml.cloud.ibm.com",
                   token = "***********",
                  )

client = APIClient(credentials)

Note: Setting a default space ID or project ID is mandatory. For details, refer to the client.set.default_space() API in this document.

Hint

You can copy the project_id from the Project’s Manage tab (Project -> Manage -> General -> Details).

Firewall settings

Although the above setup is sufficient for most environments, environments behind a firewall may need an additional adjustment. The following endpoints are used by ibm-watsonx-ai and need to be whitelisted to ensure correct functioning of the module:

https://jp-tok.ml.cloud.ibm.com
https://eu-gb.ml.cloud.ibm.com
https://eu-de.ml.cloud.ibm.com
https://us-south.ml.cloud.ibm.com

https://api.jp-tok.dataplatform.cloud.ibm.com
https://api.eu-gb.dataplatform.cloud.ibm.com
https://api.eu-de.dataplatform.cloud.ibm.com
https://api.dataplatform.cloud.ibm.com
https://api.jp-tok.dataplatform.cloud.ibm.com

https://iam.cloud.ibm.com