LlmSetClientOptions Function  
 
BOOL WINAPI LlmSetClientOptions(
  HCLIENT hClient,  
  DWORD dwOptions  
);

The LlmSetClientOptions function changes the current client option flags.

Parameters

hClient
A handle to the client session.
dwOptions
An unsigned integer that specifies one or more options.
Value Description
LLM_OPTION_NOCACHE Disables provider and model metadata caching for the client session. When this option is specified, the library will not reuse cached metadata, and provider or model information will be retrieved from the server each time it is required. This may be useful when testing or when current data is required.
LLM_OPTION_KEEPALIVE Enables persistent HTTP connections using the keep-alive mechanism. When enabled, the underlying HTTP connection may be reused for multiple requests, reducing connection overhead and improving performance. If this option is not specified, the connection may be closed after each request.
LLM_OPTION_PROXY Specifies that the connection should be made using the current Windows proxy server configuration. If the user does not have a proxy server configuration, this option is ignored. This option is typically used in environments where direct internet access is restricted.
LLM_OPTION_NOUSERAGENT Prevents the library from sending a User-Agent header with requests to the provider. By default, a User-Agent string is included to identify the client. This option may be used when a provider does not require a User-Agent header.
LLM_OPTION_SECURE Forces the use of a secure HTTPS connection when communicating with the provider. If the specified base URL or provider default would normally use an insecure protocol, it will be upgraded to a secure connection. Connections to providers such as OpenAI, Google and Anthropic will always be secure.

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 LlmSetClientOptions function replaces the current option flags for the client session. These flags control how the client establishes connections and sends requests to the service provider.

Applications should use care when changing options that affect the underlying connection, such as LLM_OPTION_SECURE or LLM_OPTION_PROXY. Changing these options may require the client to establish a new connection using different settings.

The LLM_OPTION_SECURE option forces the client to use HTTPS when communicating with the provider. This is appropriate for public API providers, but may not be supported by locally hosted providers such as LM Studio or Ollama. Attempting to force a secure connection to a provider that does not support HTTPS will cause the connection to fail.

The LLM_OPTION_PROXY option causes the client to use the configured proxy settings when connecting to the provider. This may be required in managed or corporate network environments, but should not be enabled unless proxy support is actually needed.

The LLM_OPTION_NOUSERAGENT option does not make requests anonymous. The provider may still identify the client based on authentication credentials, IP address information, request patterns, or other HTTP headers included with the request. For more information, refer to the LlmSetUserAgent method.

Setting or clearing the LLM_OPTION_NOCACHE option changes whether provider and model metadata may be cached. Applications can also use the LlmSetCacheTime function to control caching behavior in seconds.

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

LlmConnect, LlmConnectEx, LlmGetCacheTime, LlmGetClientOptions, LlmGetUserAgent, LlmSetCacheTime, LlmSetUserAgent