Routstr daemon - A CLI tool for managing routstr processes, similar to cocod (a Cashu wallet daemon).
routstrd is a Bun-based CLI tool that provides a background daemon for the Routstr protocol. It integrates with cocod for wallet management and uses the Routstr SDK to handle provider routing and model discovery.
- Daemon Mode: Run routstrd as a background HTTP server
- Wallet Integration: Works with cocod for Cashu token management
- Provider Routing: Automatically discovers and routes requests to available providers
- Config Management: Stores configuration in
~/.routstrd/
- Bun runtime
curl -fsSL https://bun.com/install | bashcd routstrd
bun install
bun link
routstrd onboardInitialize routstrd (creates config directory and sets up cocod):
routstrd onboardThis will:
- Create
~/.routstrd/directory - Create config file at
~/.routstrd/config.json - Run
cocod initto set up the wallet
Then fund with Cashu/Lightning:
cocod receive cashu <token>or
cocod receive bolt11 <amount>That's it! You can start using it on http://localhost:8008
###Start Daemon
Start the background daemon:
routstrd startWith custom port:
routstrd start --port 9000With specific provider:
routstrd start --provider https://your-provider.comCheck daemon status:
routstrd statusGet wallet balance:
routstrd balanceTest connection:
routstrd pingStop the daemon:
routstrd stopThe daemon exposes an HTTP server (default port 8008) with the following endpoints:
GET /health
POST /
Request body:
{
"model": "model-id",
"messages": [...],
"stream": false
}Response:
{
"choices": [...],
"usage": {...}
}Configuration is stored in ~/.routstrd/config.json:
{
"port": 8008,
"provider": null,
"cocodPath": null
}ROUTSTRD_DIR- Config directory (default:~/.routstrd)ROUTSTRD_SOCKET- Socket path (default:~/.routstrd/routstrd.sock)ROUTSTRD_PID- PID file path (default:~/.routstrd/routstrd.pid)
Install dependencies:
bun installRun CLI:
bun run startRun daemon:
bun run startTypecheck:
bun run lintroutstrd/
├── src/
│ ├── index.ts # Entry point with shebang
│ ├── cli.ts # Commander CLI commands
│ ├── cli-shared.ts # IPC utilities
│ ├── daemon.ts # HTTP server daemon
│ └── utils/
│ └── config.ts # Path configuration
├── package.json
└── tsconfig.json
MIT