Alternatively, you can see the list of foundation models and filter them from the Resource hub in the watsonx.ai UI. For details, see the following resources:
You can use the List the available foundation models method of the watsonx.ai API to get information about the available foundation models.
The model information that is returned includes the model ID, which you need to reference the model from your code.
List the available foundation models
Copy link to section
The List the available foundation models method in the watsonx.ai API gets information about the foundation models that are
provided by IBM in watsonx.ai and that you can for inference immediately.
curl -X GET \
'https://{region}.ml.cloud.ibm.com/ml/v1/foundation_model_specs?version=2024-05-01'
Copy to clipboardCopied to clipboard
After you get the model ID, you can reference the model ID in your code like this:
curl --request POST 'https://{cluster_url}/ml/v1/text/generation?version=2023-05-02'
-H 'Authorization: Bearer eyJhbGciOiJSUzUxM...'
-H 'Content-Type: application/json'
-H 'Accept: application/json'
--data-raw '{
"model_id": "google/flan-t5-xxl",
"input": "Tell me a story",
"project_id": "63dc4cf1-252f-424b-b52d-5cdd9814987f"
}'
Copy to clipboardCopied to clipboard
List the custom foundation models
Copy link to section
To get a list of deployed custom foundation models that you can access, use the following method. This method requires a bearer token.
curl -X GET \
'https://{region}.ml.cloud.ibm.com/ml/v4/deployments?version=2024-12-12&type=custom_foundation_model'
Copy to clipboardCopied to clipboard
List the deploy on demand models
Copy link to section
To get a list of IBM-provided foundation models that you can deploy yourself, use the following method:
curl -X GET \
'https://{region}.ml.cloud.ibm.com/ml/v1/foundation_model_specs?version=2024-12-10&filters=curated'
Copy to clipboardCopied to clipboard
Use the returned Model ID to deploy the deploy on demand foundation model to a deployment space. After you deploy the model, you can inference the model by using the API endpoint for your deployment.
Finding model IDs for inferencing the provided foundation models
Copy link to section
To find the model IDs for provided foundation models, follow these links:
Attention: Remember, you do not inference a deploy on demand foundation model by its model ID. You use the model ID only to deploy the model. After you deploy the model, you can inference the model by using
the API endpoint for your deployment.
From the watsonx.ai REST API, you can use the Create a deployment method to deploy the foundation model, and then use the Deployments > Infer text method to inference your deployed foundation model.