CLlmClient::SetModelName Method  
 
BOOL WINAPI SetModelName(
  LPCTSTR lpszModelName  
);

The SetModelName method changes the model being used with the client session.

Parameters

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 method will fail if an invalid or unsupported model name is used.

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 SetModelName method 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 SetModelFlags, those flags must be set again after calling this method.

If the model name specified by the lpszModelName parameter is the same as the current model name associated with the client session, the method returns successfully without modifying the client state. Model names are compared as literal string values and this method 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 ClearHistory after changing models unless preserving the previous conversation history is intentional.

This method 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