tModLoader

tModLoader

Not enough ratings
Terraria LLM Chat
   
Award
Favorite
Favorited
Unfavorite
Mod Features: Gameplay Tweaks
Mod Side: Both
tModLoader Version: 1.4.4
Language: English
File Size
Posted
Updated
153.498 KB
Oct 10 @ 11:35am
Oct 13 @ 7:41am
4 Change Notes ( view )

Subscribe to download
Terraria LLM Chat

Description
Description

This mod allows you to talk to your Town NPCs using chat.
You need an account with OpenRouter or OpenAI and you must set your API token in the mod settings:
- "Workshop → Manage Mods → Gear icon"
or
- "Settings → Mod Configuration → Terraria LLM Chat"



How to configure

API KEY
Configure your OpenRouter[openrouter.ai] / OpenAI[help.openai.com] token in the mod settings. The field is long, but it can be copy-pasted in.

LLM MODEL
You can also specify your favourite model. The default one is "gpt-4o".
Do not use quotation marks, just type the model ID.

For OpenRouter, you can use the following link to query all models:
- https://openrouter.ai/docs/api-reference/list-available-models?explorer=true

I personally use "deepseek/deepseek-chat-v3-0324"

For OpenAI, I can give you this information, but you can also look it up online if you need to.
- gpt-4.1 — $2.00 / 1M input, $8.00 / 1M output — high-quality dialogue, long context, strong instruction following.
- gpt-4o — $1.25 / 1M input, $10.00 / 1M output — versatile, great style and latency even when used text-only.
- o3 — $2.00 / 1M input, $8.00 / 1M output — reasoning-heavy quests/plans; use for important turns.
- o4-mini — (pricing varies; positioned as low-cost reasoning) — snappy logic for RP state/consistency.
- gpt-5 — $1.25 / 1M input, $10.00 / 1M output — strongest general model; overkill for fodder NPCs but great for key scenes.
- gpt-4o-mini — $0.15 / 1M input, $0.60 / 1M output — ultra-cheap text RP at scale.


How to use

(1) Simply open the NPC standard dialog with right click, and type in local chat using Enter like you type to a standard chat.

(2) NPC will reply in chat and inside of their dialog window.

The conversation history is saved in a folder (the path shown in "Workshop → Manage Mods → Gear icon" or "Settings → Mod Configuration → Terraria LLM Chat").
You can manually edit or purge select conversations.


NPC awareness and personality

- NPCs remember previous conversations
- NPCs are aware of the time of day
- NPCs are aware of the biome they are in
- NPCs are aware of ongoing world events/disasters.
- NPCs know their likes/dislikes.


Advanced customization

You can delete or modify NPC dialog history in TXT files inside of the Documents\My Games\Terraria\tModLoader\ModData\deon_TLC\ChatLogs folder (guide.txt, pirate.txt etc).

You can customize NPC biographies and behaviors in TXT files inside of the Documents\My Games\Terraria\tModLoader\ModData\deon_TLC\Biographies folder (guide.txt, pirate.txt etc).

For mod-added characters, you want to make a new TXT file in the same folder with the NPC's "Internal Name".
If you delete a vanilla NPC customer entry, it will be re-created automatically with default data.


The exact path is visible in Mod Settings window, as shown on the first screenshot in this mod publication

Example of the default guide bio:
Starter mentor with crafting tips and survival advice.
Likes: Forest biome; likes Merchant, Zoologist.
Dislikes: Ocean biome; dislikes Steampunker, Painter.


Feedback and support

If you are submitting an issue, please describe it and provide your client.log from tModLoader.
TModLoader forums thread: https://forums.terraria.org/index.php?threads/terraria-llm-chat.144961/


Code review
You can find the code of the mod here: https://github.com/DeonUrist/TerrariaLLMChat

Important: You can see full functionality of this mod in the code files. However the mod configuration stores your API key that is visible to the PC users. The author is not responsible if any other software or malware or person finds and uses your API key stored in the mod settings.

All rights reserved. For view only. The mod should not be redistributed in other platforms rather than Steam Workshop.
6 Comments
Would koboldcpp work with something like this?
Deon ☣  [author] Oct 13 @ 7:42am 
Version 1.3 has been published to Stable tModLoader v2025.8

Fix: Even if you close NPC dialog, the reply in chat will be prefaced by correct NPC name.
Deon ☣  [author] Oct 12 @ 3:15am 
I've added a setup video to walk you through the configuration and custom NPC prompt process. If anyone has any questions, feel free to ask.
Deon ☣  [author] Oct 11 @ 5:45am 
1.2 is published. Now it exports NPC personalities into TXT files outside of mod archive that you can edit. If you want to re-set the NPC bio to standard, just delete your TXT file and the mod will re-populate it.
Deon ☣  [author] Oct 11 @ 5:14am 
Okay I've just realized that the NPC biographics in TXT files get packaged by TMODLoader and aren't easily accessible. I will work on 1.2 to fix it.
Deon ☣  [author] Oct 10 @ 3:27pm 
If someone wants to see what I did, I will clean up and reorganize the code a bit, and post a GitHub project in a day or two.