---
id: getting-started
title: Getting Started
hide_title: false
hide_table_of_contents: false
description: Get up to speed with SAP Cloud SDK for Java in no time
keywords:
  - sap
  - cloud
  - sdk
  - ai
---

### What You'll Build

In this quickstart, you'll use the OpenAI GPT-4o model through the [Orchestration Service of AI Core](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/orchestration) for generating text.
The application will send a prompt to the AI model and display the generated response.

### Prerequisites

This quickstart assumes you have an AI Core service instance with plan `extended` or `sap-internal`.
For more information on how to set up an AI Core service instance, and which service plan to choose, please refer to [this documentation](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/service-plans).

Furthermore, it assumes you are using the `default` resource group.
If you want or need to use a different resource group, please refer to [this guide](orchestration/chat-completion#create-a-client-and-choose-an-llm), please ensure that resource group has an [orchestration deployment](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-deployment-for-orchestration).

### Add the SAP AI SDK as a Dependency

Add the following dependency to your `pom.xml` file:

```xml
<dependency>
    <groupId>com.sap.ai.sdk</groupId>
    <artifactId>orchestration</artifactId>
    <!-- Use the latest version here -->
    <version>${ai-sdk.version}</version>
</dependency>
```

### Use the Orchestration API

We'll use a `client` to interact with the Orchestration service:

```java
var client = new OrchestrationClient();
```

Next, we'll specify the model we want to use:

```java
var config = new OrchestrationModuleConfig()
        .withLlmConfig(OrchestrationAiModel.GPT_4O);
```

Now we can create our first prompt:

```java
var prompt = new OrchestrationPrompt("Hello world! Why is this phrase so famous?");

var result = client.chatCompletion(prompt, config).getContent();
```

The result will be the text generated by the AI model.

### Run the Application Locally

In order to run the application locally, you need to provide credentials for your AI Core service instance.

For this example we'll use a **service key** and pass it as an **environment variable** to the application.

```shell
cd your-spring-app/

# assuming a bash, for other shells (e.g. PowerShell) see the below documentation
export AICORE_SERVICE_KEY='{ "clientid": "...", "clientsecret": "...", "url": "...", "serviceurls": { "AI_API_URL": "..." } }'

# assuming Maven and a Spring Boot application
mvn spring-boot:run
```

Please find **detailed instructions** and more examples [in this documentation](connecting-to-ai-core#using-the-aicore_service_key-environment-variable).

### Explore Further Capabilities

Check out the options available for the `OrchestrationPrompt` and `OrchestrationModuleConfig` classes.
You can use templating, content filtering, data masking and more.
Please refer to [this documentation](orchestration/chat-completion) for more information.
