As AI becomes a core part of your applications, you increasingly rely on embeddings, vector similarity, and AI-driven features. One recurring challenge has been managing AI models and API keys in a clean, reusable, and secure way, while also allowing API keys to be updated without requiring a full rebuild.
To address this, 4D 21 R3 introduces AI Providers and Model Aliases, a unified approach to define, store, and reuse all your AI configurations, whether they come from local sources or internet-based services, in one place, and fully usable with AIKit.
A New “AI” Tab in the Settings
A new AI tab is now available in the 4D settings when working in project mode, allowing you to create, modify, and delete AI providers.
AI PROVIDERS: CENTRALIZING CONNECTION DETAILS
AI Providers allow you to define all connection-related information in one place:
- Base URL
- API key
- Organization or project identifiers
Each provider represents a connection to an AI provider, such as OpenAI or a compatible endpoint:

The provider configuration is stored in a JSON file named AIProviders.json located next to your setting.4DSetting file, depending on your deployment configuration.
MODEL ALIASES: SIMPLIFYING MODEL USAGE
While AI Providers centralize connection details, Model Aliases simplify how models are referenced in your code.
A model alias is a mapping between:
- An alias name
- A provider
- A model ID

This allows you to avoid hardcoding model names, switch models without changing your code, and keep consistency across environments.
USING AI PROVIDERS AND MODEL ALIASES IN CODE
Once everything is configured in the UI, your code becomes significantly simpler and cleaner:
Using model aliases
You can reference a model with the syntax: {model:”Modelname”}, where Modelname is a valid model defined in the Model Aliases tab:
var $client:=cs.AIKit.OpenAI.new()
var $result := $client.chat.completions.create($messages; \
{model: "Chat Model"})
When using a model alias:
- The provider is automatically resolved
- The model ID is applied
- All credentials and endpoints are used
API for AI Providers
In addition to the UI, 4D AIKit provides a new class to access AI providers programmatically:
var $AIProviders:=cs.AIKit.OpenAIProviders.new()
Listing All Provider Names
The OpenAIProviders.list() function returns a collection of all existing provider names, making it easy to build dynamic logic or validation workflows:
var $providers := $AIProviders.list()
// $providers=["LM-Studio Provider","OpenAI Provider"]
Listing All the model aliases
The OpenAIProviders.modelAliases() function returns a collection of all existing model aliases:
var $models := $AIProviders.modelAliases()
// $models=[{"name":"Chat Model","provider":"OpenAI Provider","model":"gpt-5.2-chat-latest"},...]
Conclusion
By centralizing configuration in the UI and simplifying model usage in code, AI Providers and Model Aliases make it easier than ever to build robust and maintainable AI-powered applications in 4D.
Comments are not currently available for this post.