LlmSetModelName Function  
 
BOOL WINAPI LlmSetModelName(
  HCLIENT hClient,  
  LPCTSTR lpszModelName  
);

The LlmSetModelName function changes the model being used with the client session.

Parameters

hClient
A handle to the client session.
lpszModelName
A null-terminated string which contains the name of the new model. This parameter cannot be NULL and must specify the name of a model which is supported by the current provider. The function will fail if an invalid or unsupported model name is used.

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 LlmSetModelName function changes the model associated with the client session. This affects subsequent requests and does not require the client session to be disconnected and reconnected.

The specified model name must be supported by the current provider. When the model name is changed, the internal model flags are reset to the default flags for the new model. If your application previously changed the model flags by calling LlmSetModelFlags, those flags must be set again after calling this function.

If the model name specified by the lpszModelName parameter is the same as the current model name associated with the client session, the function returns successfully without modifying the client state. Model names are compared as literal string values and this function does not attempt to resolve provider-specific aliases. For example, "gpt-5-mini" and "gpt-5.4-mini" would be treated as different model names even if the provider considers them equivalent or aliases for the same underlying model.

Changing the model name does not modify or clear the current message history. However, if conversation history is enabled, previous messages and responses may be included with subsequent requests to the new model. Because different models may interpret context differently, applications should consider calling LlmClearHistory after changing models unless preserving the previous conversation history is intentional.

This function cannot be called while another operation is in progress for the client session.

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

LlmGetModelInfo, LlmGetModelFlags, LlmGetModelName, LlmSetModelFlags