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(config) → returns any

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

Argument Reference

config struct
Required

Struct with provider and modelName (required), plus apiKey, baseUrl, temperature, maxTokens, timeout and other provider-specific options.

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