This page documents the Seine local control API for frontend integrations, automation, and observability.
Canonical machine-readable docs:
- OpenAPI:
docs/openapi/seine-api-v1.yaml - Request/response schemas:
docs/schemas/ - SSE event catalog:
docs/llm/sse-event-catalog.md
Seine supports two API startup modes.
./seine --service --api-bind 127.0.0.1:9977Behavior:
- API starts immediately.
- Miner stays idle until
POST /v1/miner/start. - Best for external controllers and dashboards.
./seine --api-server --api-bind 127.0.0.1:9977Behavior:
- API starts immediately.
- Miner start is triggered automatically at process startup.
- Control API endpoints are open by default (no API key required).
- Default bind is loopback only:
127.0.0.1:9977. - Non-loopback bind requires
--api-allow-unsafe-bind. - CORS allow-origin is configurable via
--api-cors(default*).
- Pool mode (
mode=pool) requiresmining_address,pool_url, andpool_worker. - Daemon mode (
mode=daemon) requires daemon auth token. - Pool mode may also include daemon auth to enable local daemon wallet balance alongside pool stats when a local daemon is available.
Daemon auth can be provided via:
- Startup flags:
--tokenor--cookie - Start request payload fields:
tokenorcookie_path
Rules:
tokenandcookie_pathare mutually exclusive in a start/patch payload.- Missing required mode-specific fields make
/v1/miner/startreturn400.
| Method | Path | Purpose |
|---|---|---|
GET |
/v1/health |
API liveness/version metadata |
GET |
/v1/runtime/state |
Full runtime state snapshot |
GET |
/v1/runtime/config/defaults |
Baseline config from process startup |
GET |
/v1/runtime/config/effective |
Effective config for current/next session |
POST |
/v1/miner/start |
Start mining with optional sparse overrides |
POST |
/v1/miner/stop |
Stop mining (optional wait budget) |
POST |
/v1/miner/restart |
Stop then start with optional sparse overrides |
PATCH |
/v1/miner/live-config |
Stage config changes for next start/session |
GET |
/v1/backends |
Backend phase visibility, configured backends, and detected GPUs (available_devices) |
POST |
/v1/wallet/unlock |
Store wallet password for future startup attempts |
GET |
/v1/events/stream |
Runtime SSE event stream |
GET |
/metrics |
Prometheus metrics |
- Action endpoints return
ActionResponse(ok,message,requires_restart,state). - Error responses use
ErrorBody(code,message). - State endpoints return
RuntimeStateor wrappers around effective/default config.
See schema files:
docs/schemas/action-response.schema.jsondocs/schemas/runtime-state.schema.jsondocs/schemas/start-request.schema.json
StartRequest is sparse/optional: send only keys you want to override.
High-impact groups:
- Mode/connectivity/auth:
mode,api_url,token,cookie_path,mining_address,pool_url,pool_workerOptional in pool mode:tokenorcookie_pathlets Seine read local daemon wallet balance alongside pool stats without switching out of pool mining. - Backend topology:
backend_specs,threads,cpu_affinity,cpu_profile - Runtime timing:
refresh_secs,request_timeout_secs,stats_secs - CPU/NVIDIA/Metal tuning knobs (same names as runtime config fields)
- Scheduling/accounting:
work_allocation,strict_round_accounting,nonce_iters_per_lane - UI/SSE behavior:
ui_mode,sse_enabled,refresh_on_same_height
For the full field list and value constraints, use docs/schemas/start-request.schema.json.
PATCH /v1/miner/live-config always updates staged config.
- If miner is not active: config becomes effective immediately for next start.
- If miner is active (
starting/running/stopping): response setsrequires_restart: trueand change is queued for next start.
SSE frame fields:
id: monotonic sequence numberevent: event typedata: JSON payload
Core event types:
state.changedminer.logbackend.phasenvidia.init.progressautotune.progressautotune.completedwallet.requiredwallet.loadedsolution.foundsubmit.resultdevfee.mode
Delivery notes:
- In-memory broadcast (best effort).
- Slow consumers may lag and miss older events.
- Use
GET /v1/runtime/stateafter reconnect to resync state.
Prometheus metrics exposed by the control API:
seine_miner_runningseine_miner_lifecycle_info{state="..."}seine_miner_pending_nvidiaseine_miner_start_requests_totalseine_miner_stop_requests_totalseine_miner_restart_requests_totalseine_miner_live_config_patches_totalseine_miner_wallet_unlock_requests_totalseine_miner_log_events_totalseine_miner_submitted_blocks_totalseine_miner_accepted_blocks_totalseine_miner_stale_submits_totalseine_miner_backend_quarantines_total
./seine --service --api-bind 127.0.0.1:9977
curl -s http://127.0.0.1:9977/v1/healthcurl -s -X POST http://127.0.0.1:9977/v1/miner/start \
-H 'content-type: application/json' \
-d '{
"mode":"pool",
"mining_address":"PpkFxY...",
"pool_url":"stratum+tcp://pool.example.com:3333",
"pool_worker":"rig-01",
"threads":2,
"work_allocation":"adaptive",
"stats_secs":5
}'curl -N http://127.0.0.1:9977/v1/events/streamcurl -s -X PATCH http://127.0.0.1:9977/v1/miner/live-config \
-H 'content-type: application/json' \
-d '{"ui_mode":"plain","stats_secs":3}'Check requires_restart in the response.
curl -s -X POST http://127.0.0.1:9977/v1/wallet/unlock \
-H 'content-type: application/json' \
-d '{"password":"<wallet-password>"}'curl -s -X POST http://127.0.0.1:9977/v1/miner/stop \
-H 'content-type: application/json' \
-d '{"wait_ms":10000}'