chatModel

Creates a stateless chat model connected to an LLM provider such as OpenAI, Anthropic, Mistral, Gemini, Azure OpenAI or Ollama. Use its chat() method to send a prompt.

chatModel(configName [, overrides]) → returns any

This function requires Adobe ColdFusion 2025.0.8 and up.  Not supported on Lucee, etc.

Argument Reference

configName struct
Required

Name of a model configuration, or a struct with provider and modelName (required), plus apiKey, baseUrl, temperature, maxTokens, timeout and other provider-specific options.

overrides struct

Struct of settings that override the named configuration.

Examples
Sample code invoking the chatModel function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub