Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use ChatModel when you need Spring AI’s direct, portable model contract; use ChatClient for application code that benefits from fluent prompts, defaults, advisors, tools, memory, and convenient response conversion. ChatClient is built on a ChatModel rather than being a competing model implementation. In most controllers and services, inject ChatClient. In provider adapters, shared infrastructure, and code that must construct Prompt objects or inspect raw ChatResponse metadata, inject ChatModel.

Both abstractions can make synchronous calls and reactive streams. The important differences are where request construction happens, how orchestration is applied, how configuration is overridden, and which runtime stack your application uses.

What ChatModel is in Spring AI

ChatModel is Spring AI’s low-level, provider-portable abstraction for sending a prompt to a chat model. The API extends Model<Prompt, ChatResponse> and StreamingChatModel. That gives infrastructure code a stable contract even when the underlying provider changes.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The direct request and response contract

A ChatModel accepts either a plain string or a fully constructed Prompt. A Prompt contains messages and optional ChatOptions. The result is a ChatResponse, which contains one or more generations plus response metadata supplied by the model implementation.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
ChatResponse response = chatModel.call("Explain optimistic locking in one paragraph");

For requests that need role-specific messages, stop sequences, temperature, token limits, or provider-specific settings, construct a Prompt explicitly and pass it to call(Prompt). The same abstraction exposes stream(Prompt) for a reactive stream of model output.

Where ChatModel belongs

  • Provider adapters and integrations that should not depend on application-level prompt orchestration.
  • Shared infrastructure libraries that need a direct Spring AI contract.
  • Code that must inspect every generation, finish reason, token-usage field, or other response metadata.
  • Workloads that build prompts programmatically and want model options to be explicit at the call site.
  • Tests that verify model-facing behavior without involving advisors, tools, or conversation state.

What ChatClient adds

ChatClient is the application-facing fluent API built on a ChatModel. Spring AI describes it as a fluent interface for communicating with an AI model, with synchronous and streaming programming models. A client is created from ChatClient.Builder; Spring Boot can auto-configure a prototype-scoped builder when a ChatModel is available.

Fluent prompt construction

The common path is concise and readable:

String answer = chatClient.prompt()
    .user(userInput)
    .call()
    .content();

The fluent request can add system instructions, user and assistant messages, a prompt template, runtime variables, model options, advisors, and tools before a terminal operation executes the request. This keeps application services focused on intent instead of message-list assembly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Terminal methods determine the result

Calling prompt() only starts building a request. Actual model execution occurs when a terminal result is requested. The synchronous path uses call(); from there you can request:

  • A plain String with content().
  • A raw ChatResponse with chatResponse().
  • A ChatClientResponse that includes client-side context.
  • A typed Java object with responseEntity(), when the model response is configured for conversion to that type.

The streaming path starts with stream() and can expose a reactive Flux<String>, Flux<ChatResponse>, or Flux<ChatClientResponse>.

ChatModel and ChatClient compared

Concern ChatModel ChatClient
Abstraction level Direct model contract Fluent application layer over a ChatModel
Request construction Explicit Prompt and messages Fluent system, user, template, option, advisor, and tool configuration
Response access ChatResponse directly String, ChatResponse, ChatClientResponse, or typed entity
Synchronous calls call(String) and call(Prompt) prompt()...call() followed by a terminal result method
Reactive streaming stream(Prompt) prompt()...stream() with Flux result variants
Advisors and orchestration Not the application-level focus Built-in advisor pipeline for context, RAG, memory, and other request changes
Tool calling Possible through model/provider mechanisms Integrated tool orchestration, including ToolCallingAdvisor support
Best default for controllers Usually more verbose Usually the better fit
Best default for infrastructure Usually the better fit Useful when that infrastructure intentionally owns client policy

How a ChatClient request reaches the model

  1. Build the request. Start with chatClient.prompt(), then add system content, user content, templates, variables, options, advisors, or tools.
  2. Select a terminal operation. Use call() for a blocking result or stream() for reactive output.
  3. Convert the result. Ask for content, a ChatResponse, a ChatClientResponse, or a typed entity.
  4. Delegate to the ChatModel. ChatClient assembles the effective messages and context, then invokes its underlying ChatModel.

This separation explains why ChatClient is not a second model provider. It is a policy and orchestration layer around the model contract.

Which abstraction should you inject?

Inject ChatClient in application services

Choose ChatClient when a service is answering user prompts, applying a shared system instruction, retrieving context, maintaining conversation state, invoking tools, or converting output into an application type. A builder-created client can hold defaults so every call does not repeat the same system message or option setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Spring Boot’s auto-configured prototype builder is designed for this use. Inject the builder, apply application defaults, and build a client for the service or use case. This also lets different clients over the same model have different default instructions without creating another model bean.

Inject ChatModel in infrastructure and adapters

Choose ChatModel when the code owns provider integration, needs complete control over Prompt construction, or must expose raw response generations and metadata to another layer. A model-facing component should not require callers to understand ChatClient advisors or fluent request state unless that is deliberately part of its API.

Use both when boundaries are clear

A common architecture uses ChatClient at the application boundary and ChatModel below it. For example, a controller-facing service can use ChatClient for memory and retrieval, while a batch or evaluation component can inject ChatModel to send deterministic Prompts and record raw ChatResponses. Avoid wrapping ChatClient in a class that merely forwards every method to ChatModel; choose the layer that owns the behavior you need.

Streaming and blocking behavior

Reactive streaming

Both abstractions expose reactive streaming. ChatModel provides stream(Prompt); ChatClient provides a fluent stream() path. Use streaming when the caller should receive partial output as tokens or chunks arrive, such as a server-sent-events endpoint or a conversational user interface.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Servlet and reactive stack implications

Spring AI’s implementation notes matter at runtime: streaming is supported through the reactive stack, while non-streaming support is tied to the servlet stack and can block when used inside a reactive application. A reactive endpoint should not call a blocking terminal method and assume it has become non-blocking merely because the surrounding controller returns a reactive type.

Tool calling is imperative and can also block. If a tool performs database, filesystem, or network work, account for that work in your execution model and scheduler rather than treating the model stream as fully asynchronous.

When customizing HTTP clients, configure both RestClient and WebClient when the selected model implementation uses both. Configuring only one client can leave synchronous and streaming paths with different timeouts, interceptors, or authentication behavior.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Advisors, RAG, memory, and tools

Advisors are ChatClient’s main orchestration hook

An advisor can modify a request before it reaches the model or process context around the call. Advisors are used to add conversation history, retrieve documents for retrieval-augmented generation, enforce application policies, and attach other context. Because each advisor receives the changes made by earlier advisors, order is significant. Put an advisor that supplies required context before one that consumes or summarizes that context.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Conversation memory requires an identifier

Memory advisors need ChatMemory.CONVERSATION_ID on every call. If the identifier is omitted, Spring AI raises IllegalArgumentException. Treat the conversation ID as required request data: derive it from the authenticated session, chat record, or another stable application key and pass it consistently for every turn.

The default MessageWindowChatMemory window is 20 messages. That is an implementation default, not a promise that every provider or version will retain exactly 20 messages after custom configuration. Set and verify the window for the context length and retention policy your application requires.

Tool calling is coordinated at the client layer

ChatClient supports tool calling and can automatically register ToolCallingAdvisor. Automatic registration can be disabled globally with:

spring.ai.chat.client.tool-calling.enabled=false

It can also be disabled for an individual call. Disable automatic behavior when a workflow needs explicit tool selection, a separate approval step, or a custom execution policy. Regardless of the setting, validate tool arguments and enforce authorization in the tool implementation; a model request is not an authorization boundary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Options and precedence

What ChatOptions can contain

Portable ChatOptions fields include model name, temperature, maximum tokens, frequency and presence penalties, stop sequences, top-k, and top-p. A provider can add model-specific options. This lets shared code use common controls while still exposing provider capabilities where necessary.

Startup options versus Prompt options

Options configured when the ChatModel starts establish its baseline. Options included in a Prompt fully override those startup options for that request. The word fully matters: do not assume that a Prompt-level options object merges field by field with every startup value. Define the complete effective set when a request must be deterministic.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

ChatClient defaults and request customizers

ChatClient defaults are useful when most calls share a system message, model setting, or other policy. Its incremental request customizers act as deltas over those defaults, so a single request can adjust one aspect without rebuilding the entire client configuration. Keep defaults stable and use per-request customization for intentional exceptions; otherwise, configuration becomes difficult to reason about.

Multiple models and observability

Several clients over one model type

The auto-configured builder is prototype-scoped. Build separate ChatClient instances with different defaults when one model type serves distinct use cases, such as a concise support assistant and a verbose internal analyst. This avoids duplicating ChatModel configuration merely to change prompts or client-level policies.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Different model types

For different ChatModel implementations, you can call ChatClient.create(chatModel) or ChatClient.builder(chatModel). Those direct factory methods bypass auto-configured observability and builder customizers. If tracing, metrics, or other builder integrations must remain active, use ChatClientBuilderConfigurer so the manually selected model receives the same integrations.

Resolving multiple ChatModel beans

When several ChatModel beans are present, dependency injection can become ambiguous. Mark one bean @Primary when it is the normal choice, or define an explicitly named builder/client for each model and inject the desired one by qualifier. Do not rely on bean ordering to select a provider.

Portability across providers

Spring AI’s model abstraction is intended to let an application switch providers with minimal application-code changes. The current Chat Model reference lists implementations and capabilities for OpenAI, Ollama, Amazon Bedrock, Mistral, Anthropic, and other providers. Portability is strongest when application code stays within portable Prompt, ChatOptions, and response contracts.

Provider-specific options, tool semantics, token accounting, context limits, and structured-output behavior can still differ. Keep those differences behind a provider-specific configuration or adapter, and test the exact model selected in each environment. ChatClient simplifies the application-facing call, but it cannot make provider capabilities identical.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Structured output and response metadata

Use ChatClient’s typed response conversion when the application wants a domain object and the selected model and converter support that format. This is convenient for services that should return a validated command, classification, or data-transfer object.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Use chatResponse() or ChatModel directly when you need generations, finish information, usage metadata, or provider response details. A plain content() call intentionally hides that information. Decide at the boundary whether downstream code needs a convenient value or an auditable model response.

Version alignment and API stability

The Spring AI documentation currently lists 2.0.1 as stable, with 1.1.8 and 1.0.9 also listed as stable; 2.1.0-M1 is preview. API signatures and implementation details can change between Spring AI lines. Pin the documentation and dependency line that matches your application instead of copying examples from a different major or minor version.

Before upgrading, verify builder methods, advisor registration, tool-calling defaults, memory behavior, and reactive support against the reference for the target version. A source-compatible-looking change can still alter option precedence or auto-configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical decision table

Your requirement Preferred abstraction Why
Provider adapter or shared infrastructure ChatModel Direct Prompt/ChatResponse contract and explicit options
Simple controller or service prompt ChatClient Fluent construction and concise content extraction
Shared system prompt and defaults ChatClient Builder defaults avoid repeating configuration
RAG, advisors, conversation memory, or tools ChatClient Built-in orchestration points
Raw generations and model metadata ChatModel or ChatClient.chatResponse() Both expose ChatResponse; ChatModel is the direct contract
Reactive token streaming ChatClient.stream() or ChatModel.stream() Both expose reactive streams; stack requirements still apply

Troubleshooting common mistakes

The application injects the wrong model

If startup fails with an ambiguous ChatModel dependency, choose an explicit primary bean or qualify the intended model. When multiple clients are needed, create named builders or clients rather than hoping auto-configuration can infer the business use case.

Memory fails on the second request

Check that every request carries the same non-empty ChatMemory.CONVERSATION_ID. A memory advisor cannot associate turns when the identifier is omitted or changes unexpectedly.

A reactive endpoint blocks

Inspect the terminal operation and the model implementation. Replace blocking calls with the streaming/reactive path where appropriate, and isolate imperative tool execution so it does not consume the reactive event-loop thread.

Prompt settings appear to be ignored

Compare startup ChatModel options with the options attached to the Prompt and ChatClient request. Prompt options take precedence over startup values, while ChatClient request customizers apply deltas over client defaults. Log the effective request configuration in a safe form that excludes secrets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Observability disappears after creating a client manually

Direct ChatClient.create(chatModel) and ChatClient.builder(chatModel) do not automatically retain Boot’s observability and builder customizers. Configure the client through ChatClientBuilderConfigurer when those integrations are required.

A concise selection checklist

  • Need a direct Prompt-to-ChatResponse contract? Inject ChatModel.
  • Need readable application prompts, shared defaults, advisors, RAG, memory, tools, or typed output? Inject ChatClient.
  • Need streaming? Either works, but use the reactive path and check the underlying stack.
  • Need raw metadata? Keep ChatResponse rather than reducing the result to a String.
  • Need several use-case-specific clients over one provider? Build them from the prototype builder.
  • Need several provider types? Qualify the models and preserve integrations with ChatClientBuilderConfigurer.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.