Chat models
A chat model accepts messages and returns an AIMessage. init_chat_model() selects a provider integration from a model identifier; provider packages still handle credentials and provider-specific options.
Tiny example
Section titled “Tiny example”from langchain.chat_models import init_chat_model
model = init_chat_model( "openai:gpt-5.4-mini", temperature=0, timeout=20, max_retries=2,)reply = model.invoke("Summarize ticket INC-104 in one sentence.")print(reply.text)Remember the flow
Section titled “Remember the flow”- Pick a provider and model.
- Set a timeout and retry limit.
- Send messages.
- Read the returned
AIMessageand usage metadata.
Failure note
Section titled “Failure note”A common interface does not make models interchangeable. Tool calling, structured output, token limits, pricing, and multimodal support differ. Check the selected provider integration and evaluate the exact model version.