Whatever message this page gives is out now! Go check it out!
ChatModel() is configured, call .chat() with a plain string. The string is treated as the user message.ChatModel.chat() accepts a plain string only. It does not support structured chat request objects (system + user messages). For that, use Agent(), see Build with AI.
<cfscript>
// configure chat model
chatModelConfig = {
provider : "openAI",
modelName : "gpt-5-nano",
apiKey : "#application.apiKey#"
}
// instantiate chat model
chatModel= ChatModel(chatModelConfig)
// chat with model
response = chatModel.chat("Explain quantum computing in one sentence.")
writeOutput(response.message)
</cfscript>
message and metadata from the provider. The output displays only the message.