Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Uralstech/UGemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

178 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UGemini

A Unity C# wrapper for the Google Gemini API.

openupm openupm

Deprecation Notice

Hey everyone,

UGemini was my early wrapper to make Google's Gemini API easy to use in Unity projects. Thanks a ton to everyone who's tried it, starred the repo, downloaded it, opened issues, and donated over the years. It's meant a lot!

As of recently, I've moved on from using this package in my projects in favour of a server-based implementation, so I haven't been developing this much. Google has now released their own SDKs for implementing the Gemini API for .NET and for Unity specifically.

As their GenAI SDK and Firebase AI Logic SDK supports more endpoints than this package, I've decided to archive this package. Even though the GenAI SDK is not available for Unity directly, I believe it should work through NuGetForUnity as it targets netstandard2.0.

Here are the links to the official Google packages:

Please feel free to fork this repo if needed, and thank you once again.

Installation

This should work on any reasonably modern Unity version. Built and tested in Unity 6000.0.26f1 (Unity 6).

OpenUPM

  1. Open project settings
  2. Select Package Manager
  3. Add the OpenUPM package registry:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s)
      • com.uralstech
      • com.utilities*
  4. Open the Unity Package Manager window (Window -> Package Manager)
  5. Change the registry from Unity to My Registries
  6. Add the UGemini, Utilities.Async* and Utilities.Encoder.Wav* packages

Unity Package Manager

  1. Open the Unity Package Manager window (Window -> Package Manager)
  2. Select the + icon and Add package from git URL...
  3. Paste the UPM branch URL and press enter:
    • https://github.com/Uralstech/UGemini.git#upm
  4. Check the instructions for UCloud.Operations and Utils.Singleton to install the dependencies.

Adding additional dependencies:
See the installation steps for the Utilities.Async* and Utilities.Encoder.Wav* packages.

GitHub Clone

  1. Clone or download the repository from the desired branch (master, preview/unstable)
  2. Drag the package folder UGemini/UGemini/Packages/com.uralstech.ugemini into your Unity project's Packages folder
  3. In the Packages folder of your project, add the following line to the list in manifest.json: "com.uralstech.ugemini": "2.x.x",
  4. Check the instructions for UCloud.Operations and Utils.Singleton to install the dependencies.

Adding additional dependencies:
See the installation steps for the Utilities.Async* and Utilities.Encoder.Wav* packages.

*Optional, but Utilities.Async is required for streaming content and Utilities.Encoder.Wav is recommended if you don't want to bother with encoding your AudioClips into Base64 strings manually.

Preview Versions

Do not use preview versions (i.e. versions that end with "-preview") for production use as they are unstable and untested.

Gemini API Support

  • models endpoint

    • batchEmbedContents method
    • countTokens method
    • embedContent method
    • generateAnswer method 🧪
    • generateContent method
    • get method
    • list method
    • streamGenerateContent method
  • cachedContents endpoint 🧪

    • create method
    • delete method
    • get method
    • list method
    • patch method
  • corpora endpoint 🧪 (Unstable)

    • documents endpoint
      • chunks endpoint
        • batchCreate method
        • batchDelete method
        • batchUpdate method
        • create method
        • delete method
        • get method
        • list method
        • patch method
      • create method
      • delete method
      • get method
      • list method
      • patch method
      • query method
    • create method
    • delete method
    • get method
    • list method
    • patch method
    • query method
  • files endpoint 🧪

    • delete method
    • get method
    • list method
  • media endpoint 🧪

    • upload method
  • tunedModels endpoint 🧪

    • create method
    • delete method
    • generateContent method
    • get method
    • list method
    • patch method
    • transferOwnership method
  • tunedModels.operations endpoint*

    • cancel method
    • get method
    • list method
  • operations endpoint*

    • list method

🧪 - Using the v1beta API

*Through package dependency UCloud.Operations.

Documentation

See https://uralstech.github.io/UGemini/DocSource/QuickStart.html or APIReferenceManual.pdf and Documentation.pdf in the package documentation for the reference manual and tutorial.