<aside> <img src="/icons/reorder_green.svg" alt="/icons/reorder_green.svg" width="40px" />
Table Of Content
</aside>
The LLM API Connector is a framework that enables unified access to various AI models (Claude, GPT, Gemini) within a Unity environment. This framework provides a consistent interface for utilizing APIs from different AI providers, offering features such as message exchange, streaming, and tool calling capabilities.
To use AIClient in a Unity scene, you need to add it as a component to a GameObject:
Create an empty GameObject
Click Add Component in the Inspector and search for "AIClient"
Add the AIClient component to GameObject
You must set API keys for each AI provider:
You can set this directly in the Inspector:
Add model category and API key pairs in the Model Category Key Pairs
section
You can also set model category and API key pairs in code
// Get a reference to AIClient in your script
AIClient aiClient = FindFirstObjectByType<AIClient>();
// Set API keys
aiClient.AddModelSetting(AIModelCategory.Anthropic, "your_claude_api_key");
aiClient.AddModelSetting(AIModelCategory.OpenAI, "your_openai_api_key");
aiClient.AddModelSetting(AIModelCategory.Gemini, "your_gemini_api_key");
<aside> π
If you want to get API keys, please refer these sites.
(Token usage capacity (input/output limits) depends on your AI provider's payment plan and tier)
</aside>
Choose which AI model to use:
In the Inspector, you can select a model from the Selected Model
dropdown menu.