Whatever message this page gives is out now! Go check it out!

Create a chat model

Last update:
May 18, 2026
The chat model is the fundamental interface for interacting with large language models (LLMs). It is a stateless engine: it accepts a sequence of messages (via a simple string in .chat()) and returns a response. It does not maintain conversation history or tools by itself.
Use ChatModel() with a configuration struct. The table below lists the parameters you need most often to run your first call. For the full parameter matrix (all providers), see Build with AI.
Syntax

            chatConfig = {
                PROVIDER  : "openAi",
                APIKEY    : "#application.apiKey#",
                MODELNAME : "gpt-4o-mini",
                TEMPERATURE : 0.7
            };
            chatModel = ChatModel(chatConfig);
        
Common parameters (quick reference)
Param nameTypeDescription
providerStringProvider of the model (required). Example: "openai".
baseUrlStringBase URL for the API endpoint (required or defaulted per provider).
apiKeyStringAuthentication key for cloud APIs (not used by Ollama).
modelNameStringModel identifier (required). Example: "gpt-4o-mini".
temperatureNumberRandomness of the output (optional). Typical: 0.7.
maxTokensNumberMaximum tokens to generate (optional).
timeoutNumberSeconds to wait for a response (optional).

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page