<aside> <img src="/icons/reorder_green.svg" alt="/icons/reorder_green.svg" width="40px" />

Table Of Content

</aside>

0. Overview

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.

1. Basic Setup

1) Adding the Component to a GameObject

To use AIClient in a Unity scene, you need to add it as a component to a GameObject:

  1. Create an empty GameObject

  2. Click Add Component in the Inspector and search for "AIClient"

    image.png

  3. Add the AIClient component to GameObject

    image.png

2) Setting API Keys

You must set API keys for each AI provider:

  1. You can set this directly in the Inspector: Add model category and API key pairs in the Model Category Key Pairs section

    image.png

  2. 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>

3) Selecting a Model

Choose which AI model to use:

  1. In the Inspector, you can select a model from the Selected Model dropdown menu.

    image.png