Skip to main content

HTTP REST gateway for the Kryten ecosystem — exposes KrytenClient via FastAPI

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kryten_api_gate-0.7.0.tar.gz (149.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kryten_api_gate-0.7.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file kryten_api_gate-0.7.0.tar.gz.

File metadata

  • Download URL: kryten_api_gate-0.7.0.tar.gz
  • Upload date:
  • Size: 149.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kryten_api_gate-0.7.0.tar.gz
Algorithm Hash digest
SHA256 ff8a9771cafc8ea53896804ac451154546823dfd0f6a54c95bef4a1cc95530f2
MD5 65b66c8c44443eb20ec8f05e1cc73e3f
BLAKE2b-256 98956723fae41021efa90d01028cd95710780e4e75012ec4a4ffc42cb2e876a4

See more details on using hashes here.

File details

Details for the file kryten_api_gate-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: kryten_api_gate-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kryten_api_gate-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f793e4644ab9f6f472183a302fc7059b54b460d2058a94ef841ee520d8b69509
MD5 b1c4fb3fa1df7869226f7d7aa9968d66
BLAKE2b-256 d8b1eacb3dcbb781870d5ace3e7df28136cb83c9937db2b47fe98bb4f176b9c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page