To host a hikari bot 24/7, run it on a machine that stays on instead of your PC: a Linux VPS with a systemd service if you host it yourself, or a bot plan on PlayNHost Discord bot hosting (from US$1.99 a month), where you upload your code, paste the token and press Start. In our test a hikari 2.7.0 bot used about 61 MB of memory and reached Discord about 1.3 seconds after it was launched. hikari 2.7 needs Python 3.11 or newer and has no command framework of its own, so this page includes a slash command written with hikari alone. The steps on PlayNHost:
- On the Discord bot hosting page, click Create Server on a plan. In the order window, answer What is your bot for? with Discord and pick Python.
- Open your server in the panel. The Set up your bot card on Overview opens at Connect to Discord. Its first step, What runs, should say This bot runs Python Bot.; click that step to check it, then Continue.
- At Connect to Discord, paste your token into Paste your bot token, click Connect, then Yes, continue.
- At Permissions, tick My code uses this only for the privileged intents your code asks for (the bot below needs none), click Add to a Discord server, then Continue.
- At Your code, click Upload files and upload
bot.pyand arequirements.txtthat listshikari, or click Connect Git. - On the Bot page, pane Code, keep Runtime at Python 3.12 (recommended) or pick 3.11, 3.13 or 3.14 (not 3.10), set the Entry file if it is not
bot.py, and click Save. - Click Start bot and watch Console. When your bot prints
Logged in as ..., the card says Your bot is online in Discord.
The general Python steps (packages, console lines) are in How to host a Python Discord bot. This page covers what is different with hikari.
What we measured
We ran each Python Discord library on our own servers, in the same Python 3.12 setup a bot plan uses, with a 1 GB memory limit:
| Library | Version | Memory at rest | Start to Discord's answer |
|---|---|---|---|
| hikari | 2.7.0 | 61 MB | 1.3 s |
| discord.py | 2.7.1 | 48 MB | 1.0 s |
| Pycord | 2.8.1 | 51 MB | 1.1 s |
| nextcord | 3.2.0 | 47 MB | 1.0 s |
| disnake | 2.12.2 | 47 MB | 0.9 s |
| Python alone | 3.12 | 9 MB |
How: the smallest program that loads the library and logs in with a fake token, installed the way our servers install it. Memory is what the process held 15 seconds after Discord refused the token, and start time runs from launch to that answer, so it includes one trip to Discord. Each figure is the median of three runs after a warm-up run. It is the floor: a bot that has connected, joined servers and cached members uses more, by an amount that depends on the bot.
What it means for the plan: a minimal hikari bot uses a small part of the 0.5 GB STARTER plan. Size the plan for what your own bot keeps in memory, not for the library.
A minimal hikari bot
It answers /ping with a slash command and prints a ready line. It reads the token from DISCORD_TOKEN, the name the panel gives your code.
requirements.txt
hikari>=2.7,<3
bot.py
import os
import hikari
bot = hikari.GatewayBot(token=os.environ["DISCORD_TOKEN"])
@bot.listen()
async def register_commands(event: hikari.StartedEvent) -> None:
application = await bot.rest.fetch_application()
await bot.rest.set_application_commands(
application=application.id,
commands=[bot.rest.slash_command_builder("ping", "Check that the bot answers")],
)
print(f"Logged in as {bot.get_me()}")
@bot.listen()
async def on_command(event: hikari.CommandInteractionCreateEvent) -> None:
if event.interaction.command_name == "ping":
await event.interaction.create_initial_response(
hikari.ResponseType.MESSAGE_CREATE, "Pong!"
)
bot.run()
hikari picks the event from the type on each listener. When all shards have started (StartedEvent), the bot sends its command list to Discord with set_application_commands, which replaces the bot's global commands with that list, then prints the ready line. CommandInteractionCreateEvent arrives each time someone uses a command. The Logged in as line is what turns the chip on Overview to Online in Discord.
If the token is wrong
When Discord refuses the token, hikari raises this error (the text our test bot printed):
UnauthorizedError: Unauthorized 401: '401: Unauthorized' for https://discord.com/api/v10/gateway/bot
It is a hikari.errors.UnauthorizedError, raised by hikari's first request to Discord when the bot starts, and the bot stops. Check the token on the Bot page, pane Discord: click Check now, and if it says Discord did not accept it, copy a new token in the Discord Developer Portal, Bot, Reset Token, paste it with Replace token and start the bot again. See How to create a Discord bot and get its token.
What a host needs to know about hikari
- Python 3.11 or newer. hikari 2.7.0 requires Python 3.11 or later; its README lists 3.11 to 3.15. On Python 3.10, a plain
hikariline makes pip install 2.6.0, the last release for 3.10. Withhikari>=2.7,<3pip refuses instead: the console shows pip's error and[PlayNHost] pip could not install everything in requirements.txt., and if hikari was never installed on the server, the bot then stops withModuleNotFoundError: No module named 'hikari'. Under Runtime, any choice but 3.10 works. - No command framework included. hikari gives you events and Discord's REST API; its README points to lightbulb, tanjun, crescent and arc for commands. The bot above registers its command itself on every start, which the README calls quite spammy; it suggests a command handler, or checks so the commands are sent only when they changed. A framework is one more line in
requirements.txt. - A warning on every start. hikari logs
You are running on optimization level 0 (no optimizations)and suggests-O. On a PlayNHost server the start script runs your entry file with plainpython, so you see this warning and the bot works normally. To hide it, passsuppress_optimization_warning=Truetohikari.GatewayBot(). On your own VPS you can add-Oinstead. - Logging and a banner are on by default.
GatewayBotsets up logging atINFOand prints the hikari banner. Its own line when a shard connects readsshard is ready: ...; the panel's chip does not count that line as online, so print your ownLogged in asline as above. - It checks for updates. By default,
run()asks PyPI for the newest hikari and logsA newer version of hikari is availablewhen there is one.bot.run(check_for_updates=False)turns that off. - Intents. The default is every intent that is not privileged. Reading message text needs
hikari.Intents.MESSAGE_CONTENTinintents=and Message Content Intent switched on in the Developer Portal. If your code asks for it while it is off in the Portal, Discord refuses the login. See Fix "Used disallowed intents" on your Discord bot.
Host it yourself on a Linux VPS
Check the Python version first: python3 --version must say 3.11 or newer. Debian 12 ships 3.11, Ubuntu 24.04 ships 3.12 and Debian 13 ships 3.13; Ubuntu 22.04 ships 3.10, too old for hikari 2.7. Then install Python, create a user and a folder for the bot, and install hikari in a virtual environment:
sudo apt update
sudo apt install -y python3 python3-venv
sudo useradd --system --create-home --home-dir /opt/hikari-bot bot
sudo cp bot.py requirements.txt /opt/hikari-bot/
sudo chown bot: /opt/hikari-bot/bot.py /opt/hikari-bot/requirements.txt
sudo -u bot python3 -m venv /opt/hikari-bot/venv
sudo -u bot /opt/hikari-bot/venv/bin/pip install -r /opt/hikari-bot/requirements.txt
Put the token in a file only root can read. Create /etc/hikari-bot.env with sudo nano /etc/hikari-bot.env, write one line, DISCORD_TOKEN= followed by your token, save it and run sudo chmod 600 /etc/hikari-bot.env.
Then create /etc/systemd/system/hikari-bot.service. It runs Python with -O, as hikari's README recommends for production:
[Unit]
Description=hikari Discord bot
Wants=network-online.target
After=network-online.target
[Service]
User=bot
WorkingDirectory=/opt/hikari-bot
EnvironmentFile=/etc/hikari-bot.env
Environment=PYTHONUNBUFFERED=1
ExecStart=/opt/hikari-bot/venv/bin/python -O bot.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Start it now and at every boot, then follow its output:
sudo systemctl daemon-reload
sudo systemctl enable --now hikari-bot
sudo journalctl -u hikari-bot -f
PYTHONUNBUFFERED=1 makes print() reach the journal at once instead of when a buffer fills. To update the bot, copy the new files, run the pip install line again and sudo systemctl restart hikari-bot.
Self-hosting or a bot plan
| Your own VPS | A PlayNHost bot plan | |
|---|---|---|
| Python | The version your distribution ships, which must be 3.11 or newer for hikari 2.7 | Pick 3.11, 3.12, 3.13 or 3.14 under Runtime |
| Packages | You run pip install after each change | Installed at a start after requirements.txt or the Python version changes, and at the first start a day after the last install |
| Restarts | Your systemd unit | Started again after a crash; left stopped with the reason if it crashes again within a minute |
| The token | A file you protect yourself | Stored encrypted, checked with Discord when you paste it, given to your code as DISCORD_TOKEN |
| Python flags | Add -O in ExecStart | Runs with plain python |
| System updates, firewall, SSH | Yours to do | Not your job |
Questions people ask
Do I need lightbulb, tanjun, crescent or arc?
No. hikari alone can register and answer slash commands, as the bot above shows. A framework is a ready command handler, so you do not write the registration and routing yourself once you have more than a few commands. Add it to requirements.txt; it installs at the next start.
Why does /ping not show up in my server?
Check the bot was added with Add to a Discord server and that the console shows Logged in as: the command is registered just before that line. While you test, pass guild=your_server_id to set_application_commands: the command is then created in that server only, and Discord's documentation says server commands update instantly.
Is the optimisation warning a problem?
No. It says Python runs without -O, the option that removes assert statements and other debug-only checks, which hikari suggests for speed. Your bot runs without it. Hide the warning with suppress_optimization_warning=True.
Does a hikari bot fit the smallest plan?
Yes. At about 61 MB in our test, a minimal hikari bot leaves most of the 0.5 GB STARTER plan for your own code. Move up when your bot itself needs it: large servers whose members it caches, files or images it handles, or data it keeps in memory.
Ready to run yours? Pick a plan on Discord bot hosting and upload your hikari bot.



