LlmGetClientOptions Function  
 
BOOL WINAPI LlmGetClientOptions(
  HCLIENT hClient,  
  LPDWORD lpdwOptions  
);

The LlmGetClientOptions function returns the current client option flags.

Parameters

hClient
A handle to the client session.
lpdwOptions
A pointer to an unsigned integer that will be set to the current client options when the function returns. This parameter cannot be NULL.

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 LlmGetClientOptions function returns the current option flags for the client session. The variable specified by the lpdwOptions parameter will be initialized to LLM_OPTION_NONE and then updated with the client options before the function returns. The value may contain one or more of the following flags combined with a bitwise OR operation.

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.

This function can be used in conjunction with LlmSetClientOptions to query and modify client behavior at runtime.

Example

DWORD dwProviderId = LLM_PROVIDER_NONE;
TCHAR szBaseUrl[MAX_PATH] = {0};

// Determine the provider ID for the current session and get
// the base URL used for API requests
dwProviderId = LlmGetClientProvider(hClient, szBaseUrl, _countof(szBaseUrl));

if (dwProviderId == LLM_PROVIDER_NONE)
{
    _tprintf(_T("Unable to get provider ID for this session\n"));
    return;
}

// Get the current client options
DWORD dwOptions = LLM_OPTION_NONE;

if (!LlmGetClientOptions(hClient, &dwOptions))
{
    _tprintf(_T("Unable to get client options for this session\n"));
    return;
}

// Get information about the current provider
LLM_PROVIDER_INFO providerInfo = { sizeof(providerInfo), 0 };

if (!LlmGetProviderInfo(dwProviderId, &providerInfo))
{
    _tprintf(_T("Unable to get provider information\n"));
    return;
}

_tprintf(_T("Connected to %s using %s, the connection is %s\n"),
         providerInfo.szDisplayName,
         szBaseUrl,
         ((dwOptions & LLM_OPTION_SECURE) ? _T("secure") : _T("not secure")));

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

LlmGetClientProvider, LlmGetProviderInfo, LlmSetClientOptions