Skip to content

About

LLM-backed (by Local AI Gateway) translator endpoint for XUnity.Auto.Translator.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation


XUnity-AutoTranslator-LocalGatewayEndpoint

LLM-backed (by Local AI Gateway) translator endpoint for XUnity.Auto.Translator.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Building
  5. Contributing
  6. License
  7. Acknowledgments

About The Project

This project aimed to add LLM translation from Local AI Gateway for XUnity.Auto.Translator. I focused on local because some game do not support HTTPS, so by using local instead make this Endpoint more usable. There are also added convenience like auto-launch gateway when you opened the game (when XUAT is loaded).

Of course, you can just use XUnity.AutoTranslate.LlmTranslators which this project is based on.

(back to top)

Getting Started

Prerequisites

This project needed XUnity-AutoTranslator v5.0.0 or higher to works. Usually, this already came included with the translation mod for your game. Refer to XUAT Installation for installing XUAT manually.

You also need to set up a local AI Gateway.

Only supported local AI Gateway right now are agentgateway and LiteLLM. Author recomendation is agentgateway. Created in Rust and fast program initialization compared to LiteLLM. (LiteLLM takes 1–2 minimum on the author's weak PC)

Installation

  1. Download precompiled DLL from Releases and install into XUnity.AutoTranslator\Translators folder. (The folder location may be different based on mod loader you are using to use for XUAT.)

  2. Copy the SampleConfig/LocalGateway folder to your loader configuration folder. For example, for BepInEx, in BepInEx/config.

    DLL Release is compiled with the pinned version of XUnity-AutoTranslator. (Usually, whatever is the latest version at the time of commit.)

  3. Back up your XUAT configuration file (AutoTranslatorConfig.ini). After you have a backup copy, edit the configuration and change the Endpoint setting to LocalGateway. Your [Service] section should look like this:

    [Service]
    Endpoint=LocalGateway
    FallbackEndpoint=
  4. Add the configuration for this project. Refer to Configuration section.

  5. Open your game and enjoy! ❤️

(back to top)

Usage

Configuration

Example configuration in AutoTranslatorConfig.ini.

[LocalGateway]
ServerPort=4000
BinaryPath=C:\Users\User\.local\bin\litellm.exe
BinaryArguments=file=config=C:\Users\User\Desktop\litellm-config.yaml
ApiKey=sk-67696769
ModelName=gpt-oss-20b
ModelParams=temperature=0.2;top_p=0.9;frequency_penalty=0;presence_penalty=0
UseExternalServer=False
LogServerMessages=False
  • ServerPort: Port used to launch and communicate with the server.
  • BinaryPath: Path to your preferred local gateway binary.
  • BinaryArguments: Arguments to be passed to the binary when launching the server. Do not use short options (-c, -b).

Both agentgateway and LiteLLM needs to be explicitly pointed toward configuration file and added to BinaryArguments. For agentgateway, file=C:\Users\User\.config\agentgateway\config.yaml. For LiteLLM, config=litellm-config.yaml.

  • ApiKey: API Key to access the server.
  • ModelName: Model to use for translation.
  • ModelParams: Model customization for this translation task.
  • UseExternalServer: Use external local gateway Proxy server instead. If enabled, both BinaryPath and BinaryArguments will be skipped.
  • LogServerMessages: Log Local Gateway server message in XUAT console.

(back to top)

Building

For developers, it is recommended to use your project XUnity-AutoTranslator DLL to build this project as long it meet the requirements for maximum compatibility.

  • Use latest Windows (optional for maximum compatibility).
  • Make sure latest .NET SDK is installed.
  • XUnity-AutoTranslator v5.0.0 or higher.
  • Download XUnity.AutoTranslator-Developer-X.X.X.zip.
  • If you using IL2CPP, download XUnity.AutoTranslator-Developer-IL2CPP-X.X.X.zip instead.
  • If you want to use your project DLLs, put DLLs in libs folder or libs-il2cpp if using il2cpp.

Normal Version

  1. Unzip XUnity.AutoTranslator-Developer-X.X.X.zip in this repo. Rename Developer folder to libs.

  2. Run the build command.

    dotnet build -c Release -v n -f net35
  3. Copy the builded DLL, LocalGatewayEndpoint\bin\Release\net35\LocalGateway.dll to your project XUnity.AutoTranslator\Translators folder.

IL2CPP Version

  1. Unzip XUnity.AutoTranslator-Developer-IL2CPP-X.X.X.zip in this repo. Rename Developer folder to libs-il2cpp.

  2. Run the build command.

    dotnet build -c Release -v n -f net6.0
  3. Copy the builded DLL, LocalGatewayEndpoint\bin\Release\net6.0\LocalGateway.dll to your project XUnity.AutoTranslator\Translators folder.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

Some of this project code are based on XUnity.AutoTranslate.LlmTranslators project, licensed under MIT and XUnity-AutoTranslator-StasServerEndpoint project, licensed under MIT which is a fork of XUnity-AutoTranslator-SugoiOfflineTranslatorEndpoint project.

(back to top)

Acknowledgments

(back to top)

About

LLM-backed (by Local AI Gateway) translator endpoint for XUnity.Auto.Translator.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages