Skip to main content

Model Discovery

Introduction​

This guide explains how to query the available foundation models in your SAP AI Core Gen AI Hub instance using the SAP AI SDK for Java.

warning

All classes in the ...model and ...client packages are generated from an OpenAPI specification. These classes can be used, but no API stability guarantees are provided, even for minor releases. Maintenance and support are limited to ensuring consistency with the service specification. No additional convenience API layer is provided.

Prerequisites​

Before using the AI Core module, ensure that you have met all the general requirements outlined in the overview. Additionally, include the necessary Maven dependency in your project.

Maven Dependencies​

Add the following dependency to your pom.xml file:

<dependency>
<groupId>com.sap.ai.sdk</groupId>
<artifactId>core</artifactId>
<version>${ai-sdk.version}</version>
</dependency>

See an example pom in our Spring Boot application

Get Available Models​

Use CoreApi.availableAiModels() to retrieve all foundation models available in your Gen AI Hub instance. By default, both the scenario ID ("foundation-models") and resource group ("default") are pre-filled.

AiModelList models = new CoreApi().availableAiModels();

To specify a custom scenario ID or resource group, pass them explicitly:

AiModelList models = new CoreApi().availableAiModels("foundation-models", "my-resource-group");

Both parameters are required when using the explicit overload.

Refer to the ScenarioController.java in our Spring Boot application for a complete example.

tip

Use the model names returned by this endpoint directly when creating deployments. Refer to the AI Core Deployment documentation for details on creating a deployment for a specific model.