Getting Started
You can get started in a few simple steps:

Create a Spring Boot Web application with a Spring AI OpenAI boot starter dependency. This Spring Initializr link can help you bootstrap the application. (With start.spring.io you can select any AI Models or Vector Stores that you want to use in your new applications).

Add your OpenAI key to the application.properties:

spring.ai.openai.api-key=<YOUR OPENAI KEY>
Add the following snippet to your SpringAiDemoApplication class:

@Bean
public CommandLineRunner runner(ChatClient.Builder builder) {
    return args -> {
        ChatClient chatClient = builder.build();
        String response = chatClient.prompt("Tell me a joke").call().content();
        System.out.println(response);
    };
}
Run the application:

./mvnw spring-boot:run
Want to get started in another way? View the Getting Started section in the reference documentation.