AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Model and Endpoint Configuration >

AIU. - Artificial Intelligence Utility

AIU.SetChatEndpoint

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.SetChatEndpoint
Set the Chat Endpoint URL for AIU Operations

 

Intention

 

SetChatEndpoint Command: Configuring the Chat API Endpoint
 
The SetChatEndpoint command enables you to define a custom URL endpoint for chat-related operations within the AIU system, such as AIU.Chat or AIU.ChatVision.

This customization supports integration with alternative OpenAI-compatible services, proxies, or localized API instances, enhancing flexibility and control.

It’s part of the AIU - OpenAI API suite.

 

What is the SetChatEndpoint Command?

 

This command configures the URL that the AIU system uses to send chat requests, overriding the default OpenAI chat endpoint (typically https://api.openai.com/v1/chat/completions).

It allows you to redirect chat operations to a custom server or API instance, provided it adheres to OpenAI’s chat API specification.

 

Why Do You Need It?

 

Setting a custom chat endpoint is valuable for:

Alternative Services: Integrate with non-OpenAI services that support the same API structure.

Network Control: Route requests through a proxy for monitoring, rate limiting, or security.

Development: Test scripts against a local or staging API endpoint before production use.

 

How to Use the SetChatEndpoint Command?

 

The command requires one parameter: the full URL of the desired chat endpoint.

After setting, all chat-related operations (e.g., AIU.Chat) will target this URL until it’s changed or the AIU system is reinitialized via Init_AIU().

 

Example Usage:

 

Use LM-Studio with the AI-Command:

 

' use any API-Key for LM-Studio its not approved, however the command will expect an API-Key

AIU.Set Key|Any

' construct LM-Studio Endpoint

$$LMS=http://192.168.178.99:1234

$$ENP=/v1/chat/completions

$$GES=$$LMS$$ENP

AIU.Set Chat Endpoint|$$GES

 

'Chooose local Model

AIU.SetModel|deepseek/deepseek-r1-0528-qwen3-8b

 

AIU.Chat|Tell me a joke use EMojis|$$RES|1

DBP.Joke: $$RES

ENR.

 

This sets the chat endpoint to a custom proxy and confirms the change using AIU.GetChatEndpoint.

 

Illustration

 

┌────────────────────────────┐

│ Chat Endpoint Configuration│

├────────────────────────────┤

│ https://myproxy.example.com│

└────────────────────────────┘

Visualizing the updated chat endpoint URL for AIU operations.

 

Syntax

 

AIU.SetChatEndpoint|P1

AIU.Set_ChatEndpoint|P1

 

Parameter Explanation

 

P1 - (Required) The full URL of the chat endpoint (e.g., https://api.openai.com/v1/chat/completions or a custom URL).

      If P1 = "Reset" or P1="" then the Endpoint is restored to the default endpoint

 

Example

 

AIU.SetChatEndpoint|https://local-ai-server:8080/v1/chat

AIU.Chat|What’s the weather like?|$$RES

DBP.Response from local server: $$RES

ENR.

 

Remarks

 

- The URL must conform to OpenAI’s chat API format for successful operation.

- Changes take effect immediately and persist across script execution unless reset.

 

Limitations

 

- No runtime validation of the URL’s reachability or correctness occurs.

- Exactly one parameter is required; deviations (none or multiple) result in an error.

 

See also:

 

AIU.Get_ChatEndpoint

AIU.Chat

AIU.ChatVision

Endpoint Configuration