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

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.4
File Size Uploaded
kryten_api_gate-0.8.4.tar.gz 165.6 kB Details

Built distribution (wheel)

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

Total release size: 187.9 kB

Release files / kryten_api_gate-0.8.4.tar.gz

Download URL kryten_api_gate-0.8.4.tar.gz
Size 165.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a60abbca0db3c91f2452bd545e35dfe55ea5bc630235fcd833bae145ebf1ffa7
BLAKE2b-256 checksum
How to use checksums
5c052e1c0264239551e8c2dde3cc6be6b7d74d2ac3e0189cae76cfbd16b7e4ca
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.4-py3-none-any.whl

Download URL kryten_api_gate-0.8.4-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31a8fd34363604c6d1b481a1b53df1ffca6b41988faf586734af383846c7da2f
BLAKE2b-256 checksum
How to use checksums
0fdcfd502f0e7906162cc5ec6e582e02b73cc8eea2b30d2dd2433c33087f384f
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

This release

0.8.4 This release

2 release files

0.8.3

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