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.2

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.2
File Size Uploaded
kryten_api_gate-0.8.2.tar.gz 163.7 kB Details

Built distribution (wheel)

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

Total release size: 185.6 kB

Release files / kryten_api_gate-0.8.2.tar.gz

Download URL kryten_api_gate-0.8.2.tar.gz
Size 163.7 kB
Tags Source
SHA-256 checksum
How to use checksums
04469d9b15730219ebf05d80657dceaeeb96645c388253474166e6e1e35c7cf6
BLAKE2b-256 checksum
How to use checksums
5e4ed3ac027959a98c56dcd8b1dc0dff5fad28f0b6b45da9653cee3b16f2b035
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.2-py3-none-any.whl

Download URL kryten_api_gate-0.8.2-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f68bf1b5fe912980445986bba47d8109ed11b4cced8e0f22a0f50b2da86f011
BLAKE2b-256 checksum
How to use checksums
07f39eb22e220f98580e50e8fd4a98e7755e4cee3c81ed91329ffb9ed14f5657
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

0.8.3

2 release files

This release

0.8.2 This release

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