Start the REST API server.
duh serve [OPTIONS]
Starts a FastAPI server exposing the duh consensus engine as a REST API. The server provides all consensus operations over HTTP and WebSocket, with API key authentication and rate limiting.
See REST API Reference for full endpoint documentation.
| Option | Type | Default | Description |
|---|---|---|---|
--host |
str | From config (127.0.0.1) |
Host to bind to. Use 0.0.0.0 to listen on all interfaces. |
--port |
int | From config (8080) |
Port to bind to. |
--reload |
flag | false |
Enable auto-reload for development. Restarts the server when source files change. |
Start with defaults:
duh serveListen on all interfaces:
duh serve --host 0.0.0.0Custom port with auto-reload:
duh serve --port 9000 --reloadWith a specific config:
duh --config ./production.toml serveServer settings are in the [api] section of your config file:
[api]
host = "127.0.0.1"
port = 8080
cors_origins = ["http://localhost:3000"]
rate_limit = 60 # requests per minute per API key
rate_limit_window = 60 # window in secondsSee Config Reference for all options.
When running, the server provides interactive API documentation:
- Swagger UI:
http://localhost:8080/docs - ReDoc:
http://localhost:8080/redoc
- REST API Reference -- All endpoints
- Python Client -- Client library for the API
- Config Reference -- Server configuration