Skip to main content

kryten-api-gate

HTTP REST gateway for the Kryten ecosystem — exposes kryten-py via FastAPI.

Overview

kryten-api-gate sits between HTTP clients and the Kryten NATS message bus, translating REST calls into KrytenClient commands dispatched to Kryten-Robot.

HTTP Client → kryten-api-gate → KrytenClient → NATS → Kryten-Robot → CyTube

Installation

pip install kryten-api-gate

Quick Start

  1. Copy config.example.json to config.json and fill in your values:

    {
      "nats_url": "nats://localhost:4222",
      "channel": "your-channel",
      "api_key": "your-secret-api-key",
      "host": "0.0.0.0",
      "port": 8080
    }
    
  2. Run the server:

    kryten-api-gate
    # or
    python -m kryten_api_gate
    
  3. Interactive API docs at http://localhost:8080/docs

Authentication

All endpoints (except /api/v1/system/health and /api/v1/system/version) require a Bearer token:

Authorization: Bearer <api_key>

API Routes

Prefix Description
GET /api/v1/system/health Health check (unauthenticated)
GET /api/v1/system/version Version info (unauthenticated)
POST /api/v1/chat/send Send a chat message
GET/POST /api/v1/playlist/ Playlist management
POST /api/v1/playback/ Playback control
POST /api/v1/moderation/ Moderation actions
GET/POST /api/v1/admin/ Admin channel settings
GET/POST /api/v1/emotes/ Emote management
GET/POST /api/v1/filters/ Chat filter management
GET/POST /api/v1/polls/ Poll management
GET /api/v1/library/ Media library search
GET/PUT/DELETE /api/v1/kv/ Key-value store
GET /api/v1/state/ Channel state queries

Configuration

Key Description Default
nats_url NATS server URL nats://localhost:4222
channel CyTube channel name required
api_key API authentication key required
host Listen address 0.0.0.0
port Listen port 8080
log_level Logging level info

Systemd Service

A systemd unit file is provided at systemd/kryten-api-gate.service.

Development

git clone https://github.com/grobertson/kryten-api-gate
cd kryten-api-gate
pip install -e ".[dev]"
uvicorn kryten_api_gate.app:create_app --factory --reload

License

MIT

Release files for kryten-api-gate 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kryten-api-gate 0.8.3
File Size Uploaded
kryten_api_gate-0.8.3.tar.gz 163.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kryten-api-gate 0.8.3
File Interpreter ABI Platform
kryten_api_gate-0.8.3-py3-none-any.whl Python 3 none any Details

Total release size: 185.7 kB

Release files / kryten_api_gate-0.8.3.tar.gz

Download URL kryten_api_gate-0.8.3.tar.gz
Size 163.7 kB
Tags Source
SHA-256 checksum
How to use checksums
29501a64d212b494f8c60e5d66ce548a366909da35c9d5110dd3f06ff2c766ea
BLAKE2b-256 checksum
How to use checksums
67a221d176750572f3d7fbd3cc3864dc61bba3799706bc71b450476100673b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kryten_api_gate-0.8.3-py3-none-any.whl

Download URL kryten_api_gate-0.8.3-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
183e9234c393852843b6d8d34364c3e4c100fd2b93cad72c6efe61c4ca3cd53f
BLAKE2b-256 checksum
How to use checksums
639ab317d3ee8d4514ec5a65c62c1c0a0265e112a3540943c6a4674ed84d639d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.8.4

2 release files

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page