AIDevKit - AI Suite for Unity
API ReferencesDiscordGlitch9
  • Introduction
    • AI Dev Kit 3.7.0
    • Troubleshooting
    • FAQ
    • Update Logs
      • AI Dev Kit v2
      • AI Dev Kit v1
  • Quick Start
    • API Key Setup
      • OpenAI
      • Google Gemini
      • ElevenLabs
      • OpenRouter
    • Adding Models & Voices
      • Quick Add Guide
      • Creating Snippets
    • Self-Hosting with Ollama
  • Editor Tools
    • Editor Chat
    • Asset Generators
    • Asset Managers
      • Prompt History
      • File Manager
      • Chatbot Manager
      • Assistant Manager
  • GEN Tasks
    • Overview
      • Prefixes
      • Sequence
    • Response
    • Image
    • Video
    • SoundFX
    • Speech
    • Transcript
    • Voice Change
    • Audio Isolation
  • Components
    • Chatbot
    • Chatbot (Assistants API)
    • Realtime Assistant
    • Modules
    • Event Receivers
  • Platform API
    • OpenAI
      • 💬Chat completions
      • 🖼️Image operations
      • 🗣️Text to speech
      • 🎙️Speech to text
        • Recording real-time in Unity
      • 💾Files
      • 🔎Embeddings
      • 🛡️Moderations
      • ⚙️Fine-tuning
      • Assistants API
        • How it works
        • Creating custom functions
        • Creating assistants API
    • Google Gemini
      • 📝System instructions
      • 💬Text generation
      • ⚙️Fine-tuning
      • ▶️Fucntion calling
      • 🔎Embeddings
      • 🛡️Safety
      • 💻Code execution
  • Legacy Documents
    • AI Dev Kit 1.0
      • Preperation
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
      • Troubleshooting (Legacy)
        • ❗Build Error: The name 'UnityMenu' does not exist in the current context
        • ❗The type or namespace name 'AndroidJavaObject' could not be found
        • ❗The type or namaspace name 'Plastic' does not exist
        • ❗Build Error: The name 'Asset Database' does not exist in the current context
        • ❗'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • AI Dev Kit 2.0
      • Event Handlers
      • Editor Chat
      • Editor Vision (TTI, ITI)
      • Editor Speech (TTS)
      • Management Tools
        • Prompt History Viewer
        • AI Model Manager
        • TTS Voice Manager
        • OpenAI File Manager
        • OpenAI Assistant Manager
        • ElevenLabs Voice Library
Powered by GitBook
On this page
  1. Quick Start
  2. Adding Models & Voices

Creating Snippets

Create code snippets with one click.

PreviousQuick Add GuideNextSelf-Hosting with Ollama

Last updated 5 days ago

Once you've added your models or voices to the library, you can create reusable code snippets using the "Create Snippets" button located at the bottom of the Model Library or Voice Library window.

What is a Snippet?

A snippet is a small block of pre-written code that makes it easy to call a specific model or voice without typing the configuration manually each time. It’s especially useful for automating prompts, speech generation, or completions in your game or editor tools.

Think of snippets as ready-to-use shortcuts for your favorite models and voices.


How to Create a Snippet

  1. Add at least one model or voice to your library (if you haven’t already)

  2. Click the “Create Snippets” button

  3. Snippets will be automatically generated and saved as C# files in your project (usually under Assets/AIDevKit/Snippets/)


Using Snippets

Once created, you can call your saved model or voice like this:

"My prompt here"
    .GENResponse()
    .SetModel(OpenAIModels.GPT4o)
    .ExecuteAsync();

"Hello!"
    .GENSpeech()
    .SetVoice(ElevenLabsVoices.Rachel)
    .ExecuteAsync();

These snippets are especially useful for:

  • Auto-complete

  • Reducing errors

  • Keeping your AI calls consistent across your project