CLlmClient::SetModelFlags Method  
 
BOOL SetModelFlags(
  DWORD dwModelFlags  
);

The SetModelFlags method sets model behavior flags for a client session.

Parameters

dwModelFlags
An unsigned integer which specifies one or more capability flags for the selected model. This value cannot be zero.
Name Description
LLM_MODEL_FLAG_CHAT Supports conversational text generation
LLM_MODEL_FLAG_SYSTEM_ROLE Accepts a system role message in the input
LLM_MODEL_FLAG_STREAMING Supports streaming responses
LLM_MODEL_FLAG_STRUCTURED Supports structured output (e.g., JSON or schema)
LLM_MODEL_FLAG_VISION Supports image inputs (multimodal)
LLM_MODEL_FLAG_TOOLS Supports tool or function calling
LLM_MODEL_FLAG_REASONING Supports reasoning-oriented generation
LLM_MODEL_FLAG_RESPONSES Supports the Responses API (unified endpoint)
LLM_MODEL_FLAG_FUNCTIONS Supports OpenAI-style function calling with schemas
LLM_MODEL_FLAG_AUDIO Supports audio output (text-to-speech)
LLM_MODEL_FLAG_IMAGE Supports image generation
LLM_MODEL_FLAG_VIDEO Supports video generation
LLM_MODEL_FLAG_TRANSCRIPTION Supports speech-to-text transcription
LLM_MODEL_FLAG_INSTRUCTIONS Supports a dedicated instruction field outside message lists
LLM_MODEL_FLAG_MAX_COMPLETION_TOKENS Uses max_completion_tokens instead of max_tokens in requests
LLM_MODEL_FLAG_IGNORE_TUNING Model should not use explicit sampling and penalty parameters

Return Value

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

Remarks

The SetModelFlags method 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 method 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.

Clearing the LLM_MODEL_FLAG_IGNORE_TUNING flag may cause requests to fail if the selected model does not support explicit tuning parameters; for example, some Anthropic models return an HTTP 400 error when non-default tuning values are specified.

Changing the current model using the SetModelName method 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
Unicode: Implemented as Unicode and ANSI versions

See Also