LlmSetModelFlags Function  
 
BOOL WINAPI LlmSetModelFlags(
  HCLIENT hClient,  
  DWORD dwModelFlags  
);

The LlmSetModelFlags function sets model behavior flags for a client session.

Parameters

hClient
A handle to the client session.
dwModelFlags
An unsigned integer which specifies one or more capability flags for the selected model. This value cannot be zero.
NameDescription
LLM_MODEL_FLAG_CHATSupports conversational text generation
LLM_MODEL_FLAG_SYSTEM_ROLEAccepts a system role message in the input
LLM_MODEL_FLAG_STREAMINGSupports streaming responses
LLM_MODEL_FLAG_STRUCTUREDSupports structured output (e.g., JSON or schema)
LLM_MODEL_FLAG_VISIONSupports image inputs (multimodal)
LLM_MODEL_FLAG_TOOLSSupports tool or function calling
LLM_MODEL_FLAG_REASONINGSupports reasoning-oriented generation
LLM_MODEL_FLAG_RESPONSESSupports the Responses API (unified endpoint)
LLM_MODEL_FLAG_FUNCTIONSSupports OpenAI-style function calling with schemas
LLM_MODEL_FLAG_AUDIOSupports audio output (text-to-speech)
LLM_MODEL_FLAG_IMAGESupports image generation
LLM_MODEL_FLAG_VIDEOSupports video generation
LLM_MODEL_FLAG_TRANSCRIPTIONSupports speech-to-text transcription
LLM_MODEL_FLAG_INSTRUCTIONSSupports a dedicated instruction field outside message lists
LLM_MODEL_FLAG_MAX_COMPLETION_TOKENSUses max_completion_tokens instead of max_tokens in requests

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call LlmGetLastError.

Remarks

The LlmSetModelFlags function overrides the capability flags associated with the currently selected model. These flags determine how the client formats requests and interprets responses for the model.

Model capability flags are normally determined automatically by the library based on the selected provider and model. This function is primarily intended for advanced scenarios where the default behavior must be adjusted, such as when working with custom providers, locally hosted models, or when a model's capabilities have changed and are not yet reflected in the library.

The specified flags must include LLM_MODEL_FLAG_CHAT, as the API requires a chat-based interface for sending and receiving messages. Specifying flags that are not supported by the selected model may result in request failures or undefined behavior.

Changing model flags can affect how requests are constructed, such as which parameters are used, how input is formatted, and which features are enabled. Applications should only modify these flags if they fully understand the capabilities of the target model.

If you enable a capability that is not supported by the model or provider, this will often result in an error condition and may cause subsequent requests to fail. For example, if you attempt to force the use of a system prompt by setting the LLM_MODEL_FLAG_SYSTEM_ROLE flag, this can cause unexpected failures on models hosted locally using an application like LM Studio.

Changing the current model using the LlmSetModelName function will reset the model flags for the session back to their default values for the new model.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib

See Also

LlmGetModelInfo, LlmGetModelFlags, LlmGetModelName, LlmSetModelName