ChatOpenAI is a LangChain class for calling an OpenAI chat model. In a chatbot, it can supply the response-generating step of a LangGraph graph. section 10.2.3
Call the model from a graph node
Create the model with `ChatOpenAI(model_name="gpt-5.1", openai_api_key=...)`. The assistant node passes its message list to `llm.invoke(messages)`, then adds the returned AI message to the graph state. A user message starts the graph; the final message supplies the reply. section 10.2.3
For a Streamlit chatbot, the bot can receive an API key from Streamlit secrets, construct ChatOpenAI with a `max_tokens` setting, and pass it to the graph. This keeps model setup separate from the chat interface. section 10.2.3

