beginnerSpring AI Setup & Hello World

What's the minimum Spring AI needs configured before `ChatClient` can talk to a real model provider?

A starter dependency for the specific provider (e.g. `spring-ai-openai-spring-boot-starter`) plus an API key set via `application.properties` or an environment variable — Spring Boot's auto-configuration then wires a `ChatModel` bean automatically from that starter being on the classpath, which `ChatClient.Builder` uses under the hood.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to Why does Spring AI provide `ChatClient` as an abstraction instead of exposing each provider's raw SDK directly?← Back to all Spring AI questions