using AI to make a free discord translator bot

I know usually AI gets a bad rap but i think this is genuinely a neat use of it.
i made an ollama server running google's gemma model and made discord bot that directly sends requests to it from discord. effectively having a discord bot that talks to AI. while one of the features is for it spout the usual senseless AI drivel queries youd expect, i added a feature that normally other discord bots require payment for and this self hosting solution allows it to exist for free:

1749620280739.png

in case you are curious to see what the bakend looks like:

1749621193003.png


As mentioned Translator already exists and its a fine discord app, but i figured id make my own running off a small repurposed chromebox, or my homelab pc running in my garage, assisted by google's gemma. so far i added support for 5 languages (german, spanish, japanese, english and french).
this post is rather short but wanted to highlight that AI can have clever uses in a discord specially if you are trying to communicate to an international audience.

until next time fella's

Comments

Why not just use the non-ai Google Translate? It can be inaccurate but you don't need AI for everything. AI can have hallucinations too.
Because the Google translate api costs money. This is meant to be a free solution for a small server on discord. When you have people talking on discord it's a lot less practical to copy paste every message and post it on Google translate as well. Also hallucinations tend to happen on rather large explanations for things.
 
Last edited:
Because the Google translate api costs money. This is meant to be a free solution for a small server on discord. When you have people talking on discord it's a lot less practical to copy paste every message and post it on Google translate as well. Also hallucinations tend to happen on rather large explanations for things.
oh it cost money? idk that
 
Because the Google translate api costs money. This is meant to be a free solution for a small server on discord. When you have people talking on discord it's a lot less practical to copy paste every message and post it on Google translate as well. Also hallucinations tend to happen on rather large explanations for things.
You can actually use it for free. I have my own tool to live translate chat in ArcheRage as it has a mix of Chinese and Russian that I can't read, in months of it being used I've not hit any limits. I did add alternative translation provider plugins, but LLMs seemed quite a bit less reliable in terms of keeping them from breaking out of the constraints (particularly dumber ones if you want quick responses on local hardware without performance penalties).

In any case, the free access to the translation API would suffice for a small server.
 
You can actually use it for free. I have my own tool to live translate chat in ArcheRage as it has a mix of Chinese and Russian that I can't read, in months of it being used I've not hit any limits. I did add alternative translation provider plugins, but LLMs seemed quite a bit less reliable in terms of keeping them from breaking out of the constraints (particularly dumber ones if you want quick responses on local hardware without performance penalties).

In any case, the free access to the translation API would suffice for a small server.
Word. Got a link to their API info page?
 
Last edited:
I looked into your suggestion and their translate api uses Gemini which is the same LLM (well Gemma, the ollama counterpart) I'm running locally. It also only seems free for up to 500000 characters a month. im currently using their 12b model and it seems fairly accurate enough. to be fair i have a homelab pc doing the gruntwork with spare parts and its been ok so far. probably not a solution for everyone either.
 

Attachments

  • Screenshot_20250611-135605.png
    Screenshot_20250611-135605.png
    270.1 KB · Views: 41
Last edited:
Word. Got a link to their API info page?
It was as simple as sending a get request to this (ofc with the correct language parameters and whatnot):

https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=<some text>

It was certainly enough for my live chat translation, so it's probably good enough for most. I never reached the limits, but it's worth noting that due to the spamming nature of the chat people, I did end up implementing a cache layer to prevent duplicate requests.
 
  • Like
Reactions: WD_GASTER2
It was as simple as sending a get request to this (ofc with the correct language parameters and whatnot):

https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=<some text>

It was certainly enough for my live chat translation, so it's probably good enough for most. I never reached the limits, but it's worth noting that due to the spamming nature of the chat people, I did end up implementing a cache layer to prevent duplicate requests.
i really appreciate you taking the time to show me this. will keep it in my notes and probably will implement it into the bot as a backup method as well. its great to know how to do things in more than one way!
thank you!
 
i really appreciate you taking the time to show me this. will keep it in my notes and probably will implement it into the bot as a backup method as well. its great to know how to do things in more than one way!
thank you!
I briefly used DeepL, but quickly hit the free plan limits. I know there's a Chinese one as well that seems to be pretty good in terms of limits or lack thereof, but I can't recall what it was anymore. But yeah, I just ended up settling for Google Translate in the end.
 

Blog entry information

Author
WD_GASTER2
Views
686
Comments
11
Last update

More entries in Personal Blogs

More entries from WD_GASTER2