Registry / http-networking / hikari

hikari

JSON →
library2.5.0pypypi✓ verified 84d ago

Hikari is an asyncio-native Discord API wrapper for Python 3.10+ (Python 3.14 compatible via <3.15 constraint). As of v2.5.0, it provides both REST and gateway (WebSocket) APIs with a model-first design. The library replaces the older lightbulb command framework with first-class interaction support. Breaking changes between 2.x minor versions mainly involve gateway event handling and model attribute casing.

pip install hikari
INSTALL
IMPORT
SIG · HIKARI
H
hikari
http-networkingpythonv2.5.0
Install
4.5s avg
Import
1590ms
Disk
39MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 1.689s · 38.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.5s · import 1.491s · 41MB
39MB installed
● package 39MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RESTApp
from hikari import RESTApp
from hikari.impl import RESTApp
Top-level exports changed in v2; the legacy impl submodule is still available but not recommended.
GatewayBot
from hikari import GatewayBot
from hikari.impl import GatewayBot
Same as RESTApp, prefer top-level.
Intents
from hikari import Intents
Bitwise intents enum merged into top-level in v2.
events
import hikari.events as events
Events are accessed via the hikari.events module.

Simple bot that responds to !ping with Pong! using GatewayBot.

import asyncio import os import hikari bot = hikari.GatewayBot(token=os.environ.get('DISCORD_TOKEN', '')) @bot.listen() async def on_message(event: hikari.events.MessageCreateEvent) -> None: if event.content and event.content.startswith('!ping'): await event.message.respond('Pong!') if __name__ == '__main__': bot.run()
Debug
Known issues
breakingGatewayBot.listen() no longer accepts a lambda as the event handler in v2.5. Use an async function or a callable class.
fix
Use an async function or a callable class that can be awaited.
affects: >=2.5.0
breakingCache configuration has changed in v2.5.0: the cache is now passed via the 'cache' parameter of GatewayBot or RESTBot, not via a separate component.
fix
Move cache configuration from a cache component to the GatewayBot constructor, e.g., bot = GatewayBot(token=..., cache=hikari.CacheSettings(...)).
affects: >=2.5.0
deprecatedhikari.Message.mention field is deprecated, use hikari.Message.user_mentions or hikari.Message.role_mention_ids.
fix
Replace .mention with .user_mentions for user mentions or .role_mention_ids for role mentions.
affects: >=2.5.0
gotchaRESTBot and GatewayBot require aiohttp session management; do not create multiple sessions without closing previous ones (resource leak).
fix
Use the bot as a context manager (async with bot:) or call bot.close() on shutdown.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'GatewayBot' from 'hikari'
Attempting to import from 'hikari' directly in an older version where the classes were in 'hikari.impl'.
fix
Ensure you have hikari>=2.0.0 installed: pip install hikari --upgrade
TypeError: object NoneType can't be used in 'await' expression (attempting to use lambda)
Passing a lambda as event handler to bot.listen() in hikari>=2.5.0, which requires a coroutine function.
fix
Replace the lambda with an async function.
Upgrade
Version history
2.5.0latest on PyPI · released Oct 31, 2025
Audit
Dependencies
aiohttprequiredHTTP client for REST API
aiodnsoptionalDNS resolution (recommended on Linux)
orjsonoptionalFast JSON serialization
Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
hikari — pip install hikari · libregistry