LLM-backed (by Local AI Gateway) translator endpoint for XUnity.Auto.Translator.
Table of Contents
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.
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)
-
Download precompiled DLL from Releases and install into
XUnity.AutoTranslator\Translatorsfolder. (The folder location may be different based on mod loader you are using to use for XUAT.) -
Copy the
SampleConfig/LocalGatewayfolder to your loader configuration folder. For example, for BepInEx, inBepInEx/config.DLL Release is compiled with the pinned version of XUnity-AutoTranslator. (Usually, whatever is the latest version at the time of commit.)
-
Back up your XUAT configuration file (
AutoTranslatorConfig.ini). After you have a backup copy, edit the configuration and change theEndpointsetting toLocalGateway. Your[Service]section should look like this:[Service] Endpoint=LocalGateway FallbackEndpoint=
-
Add the configuration for this project. Refer to Configuration section.
-
Open your game and enjoy! ❤️
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=FalseServerPort: 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, bothBinaryPathandBinaryArgumentswill be skipped.LogServerMessages: Log Local Gateway server message in XUAT console.
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.
-
Unzip XUnity.AutoTranslator-Developer-X.X.X.zip in this repo. Rename
Developerfolder tolibs. -
Run the build command.
dotnet build -c Release -v n -f net35
-
Copy the builded DLL,
LocalGatewayEndpoint\bin\Release\net35\LocalGateway.dllto your projectXUnity.AutoTranslator\Translatorsfolder.
-
Unzip XUnity.AutoTranslator-Developer-IL2CPP-X.X.X.zip in this repo. Rename
Developerfolder tolibs-il2cpp. -
Run the build command.
dotnet build -c Release -v n -f net6.0
-
Copy the builded DLL,
LocalGatewayEndpoint\bin\Release\net6.0\LocalGateway.dllto your projectXUnity.AutoTranslator\Translatorsfolder.
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
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.
- Thanks to joshfreitas1984 for XUnity.AutoTranslate.LlmTranslators.
- Thanks to Vin-meido for XUnity-AutoTranslator-SugoiOfflineTranslatorEndpoint.