ValheimCli

v0.5.0·Updated 2026-10-11

Let AI agents control Valheim through a local API. Optional CLI; bring your own agent.

About this mod Author’s original text

ValheimCli

An experimental BepInEx plugin for a local command-line client. A shell-capable AI agent can call the client and parse JSON. No AI model or autonomous gameplay is bundled.

Version 0.1.0, MIT license. Windows Valheim 1.0.17 and Gale 1.23.1 were smoke-tested on 2026-10-10. Compilation references target Valheim 1.0.16. Other game versions/platforms and multiplayer behavior have not been verified in game.

What it does

  • status: local player/world state, position, host and teleport permissions.
  • players: currently loaded player objects, not the full server roster.
  • teleport X Y Z --confirm: opt-in teleport of the local host's own living character.

Joining clients cannot teleport through this release, even if they are server admins. No admin grants, mining, building, combat, arbitrary console or shell commands, remote endpoint, world-file editing, or outbound AI connections.

Upgrading from the old name

This package replaces swear01-ValheimCliBridge. Uninstall the old package before installing ValheimCli; both contain the same bridge DLL. Keep your existing config and token private. The internal plugin name, DLL and configuration filenames still use ValheimCliBridge and are unchanged, so existing CLI commands continue to work.

Installation

Install this package and its BepInEx dependency with Gale, r2modman or Mod Manager, then launch the modded game. Only the computer running the CLI needs this bridge. It is a client game plugin; dedicated-server automation is not supported.

For manual installation, place ValheimCliBridge.dll in BepInEx/plugins/swear01-ValheimCliBridge/ in the game/profile. Exit the game before installing or replacing the DLL. Avoid installing two copies of the bridge.

The command-line client requires Node.js 22+ on the same computer as Valheim. Download valheim-agent-cli-0.1.0.tgz from GitHub Releases, then run:

npm install -g.\valheim-agent-cli-0.1.0.tgz

valheim status --profile "C:\path\to\your\profile"

valheim players --profile "C:\path\to\your\profile"

The CLI is distributed as a GitHub release tarball. Do not assume an npm registry release exists. Installing the CLI tarball has no install hooks; this mod package does not install Node.js or run npm for you.

On first game launch the bridge generates BepInEx/config/swear01.ValheimCliBridge.cfg and a random swear01.ValheimCliBridge.token. Keep the token local. Never share it or include it in exported profiles/modpacks. It inherits the profile folder's OS permissions; restrict that folder if other users share your computer.

Teleport permission

Teleport is off by default:

[Permissions]

AllowTeleport = false

With a configuration manager already installed, open F10 / Mods settings → Valheim CLI Bridge and toggle AllowTeleport. This permission updates immediately through the in-game UI. Alternatively, exit the game, edit the config, and relaunch. Bridge Enabled / Port changes require a restart.

valheim teleport 120 45 -230 --profile "C:\path\to\your\profile" --confirm

Coordinates are X, Y (height), Z. Use a known safe standing position in a test/backup world. Valid coordinate bounds do not guarantee safe ground. A state: "started" response is only the start of a teleport; query status afterward and check teleporting and actual position for arrival.

After a timeout or dropped connection, never automatically retry a write. Inspect the game state. Use --request-id to preserve an operation ID. Started or uncertain write IDs are retained until restart, up to 256; reusing one is rejected. Restart clears this history, so this is not persistent exactly-once delivery.

Connection and removal

The bridge listens only on 127.0.0.1:28761 and authenticates every request with the profile token. It exposes no LAN/Internet service. Do not forward the port. For a custom config Port, pass the same port via CLI --port.

If the CLI cannot connect, confirm the correct modded profile is running and the bridge loaded. A successful BepInEx load alone

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.

Dependencies

Install these first, or the mod will not work:

denikson-BepInExPack_Valheim

File & checksum

Filename
ValheimCli-0.5.0.zip
File size
177.5 KiB