A simple REST API server for chatting with an elizaOS agent using Elysia (Bun's fast web framework).
No API keys or external services required for local mode. Uses:
plugin-sqlwith PGLite by default for local storageplugin-eliza-classicfor pattern-matching responses (no LLM needed)
# From the monorepo root, install dependencies
cd /path/to/eliza
bun install
# Start the server
bun run examples/rest-api/elysia/server.tsNote: This example must be run from the monorepo root to resolve workspace dependencies.
The server will start at http://localhost:3000
Returns information about the agent.
curl http://localhost:3000/Health check endpoint.
curl http://localhost:3000/healthSend a message to the agent.
curl -X POST http://localhost:3000/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello, how are you?"}'Response:
{
"response": "How do you do. Please state your problem.",
"character": "Eliza",
"userId": "generated-uuid"
}Set the PORT environment variable to change the default port:
PORT=8080 bun run startbun run test
bun run typecheckThe test suite imports the Elysia app without binding port 3000 and verifies CORS plus request validation.
Elysia is a fast, type-safe web framework designed for Bun. It provides:
- End-to-end type safety
- Automatic request validation
- High performance
- Excellent developer experience