ChatClient vs ChatModel: Which Spring AI API Should You Use?

Spring AI gives you two ways to talk to an LLM: ChatClient and ChatModel. Picking the wrong one can cost you time and flexibility. In this video, I break down both APIs so you know exactly when to reach for each one. We'll explore the high-level ChatClient (a fluent, builder-style API similar to RestClient) and the low-level ChatModel interface that it's built on. You'll see both in action with hands-on code demos using OpenAI, including how to get metadata, token usage, and even multiple response generations from a single call. • ChatClient is the high-level fluent API. Start here for almost every Spring AI project • ChatModel is the low-level interface that ChatClient wraps, giving you fine-grained control and raw response metadata • Spring AI lets you write code to an abstraction so you can easily swap LLM providers • ChatModel gives you access to token usage, finish reasons, model info, and multi-generation responses • Both APIs ultimately call the same provider. ChatClient is built on top of ChatModel 0:00 - Intro — Two ways to talk to an LLM 0:30 - Why writing to an abstraction matters 1:15 - ChatClient overview — the high-level API 2:10 - ChatModel overview — the low-level API 3:00 - ChatClient vs ChatModel at a glance 4:00 - When to use which API 4:45 - Spring AI documentation walkthrough 5:30 - Setting up the project on start.spring.io 6:30 - Configuring the OpenAI API key 7:00 - ChatClient code demo — builder, prompt, and response 9:00 - Testing the ChatClient endpoint 9:45 - ChatModel code demo — prompt, response, metadata 12:00 - Accessing token usage and model metadata 13:00 - Multi-generation demo with ChatModel 14:30 - Wrap-up and final thoughts 🔗Resources & Links mentioned in this video: Spring AI Documentation: https://docs.spring.io/spring-ai/refe... 👋🏻Connect with me: Website: https://www.danvega.dev Twitter:   / therealdanvega   Github: https://github.com/danvega LinkedIn:   / danvega   Newsletter: https://www.danvega.dev/newsletter SUBSCRIBE TO MY CHANNEL: http://bit.ly/2re4GH0 ❤️