Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

willtho89/stremio-ai-companion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

153 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Stremio AI Companion

Important

This repository is archived. I highly recommend Stremio AI Search or AIOMetadata to continue using LLMs for content search.

CI CD Security

๐ŸŽฌ Your AI-powered movie and tv series discovery companion for Stremio โ€” powered by advanced natural language understanding using OpenAI-compatible APIs. Discover perfect films using intelligent recommendations and AI-curated collections.

Demo Screenshot


โœจ Features

  • ๐Ÿง โ€‚Natural language movie & series search: e.g. โ€œfeel-good sci-fi from the 90sโ€
  • ๐ŸŽฏโ€‚Smart AI recommendations based on mood and context
  • ๐ŸŽจโ€‚Detailed movie & TV data from TMDB + optional enhanced artwork from RPDB
  • โšกโ€‚Fast response time โ€” typically 5โ€“6 seconds per query
  • ๐Ÿ”โ€‚100% privacy-first: encrypted, stateless config via shareable URLs
  • ๐ŸŽž๏ธโ€‚Split manifest support: Movies, Series, or both (toggleable)
  • ๐Ÿงบโ€‚AI-curated catalogs (predefined prompts)
  • ๐Ÿงฉโ€‚Native Stremio support: works as a catalog addon (movies, series, and catalogs)

๐Ÿš€ Quick Start

1. Install Dependencies

pip install -r requirements.txt

2. Get API Keys

  • ๐Ÿ”‘โ€‚AI Provider Key (choose one):
    • OpenAI
    • OpenRouter โ€” supports many models incl. Claude, Gemini, GPT-4 family
  • ๐ŸŽฌโ€‚TMDB v4 Read Access Token
  • ๐Ÿ–ผ๏ธโ€‚RPDB API Key (optional)

3. Run the Server

python main.py
# or with uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000

4. Configure Your Companion

  1. Visit http://localhost:8000
  2. Click "Configure Your AI Companion"
  3. Enter API keys and preferences
  4. Copy the generated manifest URL
  5. Paste it into Stremio as a new addon

๐Ÿง  How It Works

  1. Describe what you want to watch.
  2. AI understands your request, extracts intent.
  3. Suggests clever matches using natural language & GPT-style models.
  4. Metadata enriched with TMDB for movies and TV.
  5. Optional artwork enhancement via RPDB.

Examples:

  • โ€œfilms like Inception and The Matrixโ€
  • โ€œtv shows like True Detective season 1โ€
  • โ€œlighthearted rom-coms from Europeโ€
  • โ€œspace horror set on abandoned shipsโ€

๐ŸŒ Deployment

Docker (run prebuilt image)

docker run -d \
  -p 8000:8000 \
  -e ENCRYPTION_KEY="your-strong-key" \
  ghcr.io/willtho89/stremio-ai-companion:latest

Optional environment overrides (add -e for any you need):

  • OPENAI_API_KEY, OPENAI_BASE_URL, DEFAULT_MODEL
  • TMDB_API_KEY, RPDB_API_KEY
  • ENABLE_FEED_CATALOGS, SPLIT_MANIFESTS, MAX_CATALOG_RESULTS, MAX_CATALOG_ENTRIES, CACHE_SEARCH_QUERY_TTL
  • LOG_LEVEL, HOST, PORT
  • REDIS_HOST, REDIS_PORT, REDIS_DB (enable shared caching if set)

Docker Compose (recommended)

docker compose up -d

Create a .env file in the project root or export envs in your shell. Example .env:

# Required
ENCRYPTION_KEY=replace-this-key

# AI Provider
OPENAI_API_KEY=your-openai-or-openrouter-key
OPENAI_BASE_URL=https://openrouter.ai/api/v1
DEFAULT_MODEL=openai/gpt-5-mini:online

# Data sources
TMDB_API_KEY=your-tmdb-v4-read-token
RPDB_API_KEY=optional

# Catalogs, manifests, caching
ENABLE_FEED_CATALOGS=true
SPLIT_MANIFESTS=false
MAX_CATALOG_RESULTS=10
MAX_CATALOG_ENTRIES=100
CACHE_SEARCH_QUERY_TTL=14400

# UI / Server
FOOTER_ENABLED=true
LOG_LEVEL=INFO
HOST=0.0.0.0
PORT=8000

# Redis (optional). If set, enables shared caching
# REDIS_HOST=redis
# REDIS_PORT=6379
# REDIS_DB=0

Note: The compose file also supports UVICORN_WORKERS for multi-worker deployments inside the container. If unset or 0, it auto-scales based on CPU.


โš™๏ธ Environment Variables

These are loaded via Pydantic BaseSettings. Defaults shown are the in-code defaults unless stated otherwise.

Variable Description Default
ENCRYPTION_KEY Encryption key for secure, stateless configs (req.) โ€”
OPENAI_API_KEY OpenAI/OpenRouter-compatible API key โ€”
OPENAI_BASE_URL AI gateway base URL https://openrouter.ai/api/v1
DEFAULT_MODEL Default model identifier openai/gpt-5-mini:online
PREFERRED_USER_SEARCH_LANGUAGE Preferred language for user search queries en-US
TMDB_API_KEY TMDB v4 Read Access Token โ€”
RPDB_API_KEY RatingPosterDB API key (optional) โ€”
MAX_CATALOG_RESULTS Max results returned per generation 10
MAX_CATALOG_ENTRIES Max total cached entries per catalog (Redis) 100
CACHE_SEARCH_QUERY_TTL Cache TTL (seconds) for explicit search results 14400
SPLIT_MANIFESTS Enable separate movie/series manifests false
ENABLE_FEED_CATALOGS Expose predefined AI-curated catalogs in manifest true
FOOTER_ENABLED Show footer on web pages true
LOG_LEVEL Logging level INFO
HOST Bind host 0.0.0.0
PORT Bind port 8000
STREMIO_ADDON_ID Base addon identifier in manifest ai.companion.stremio
REDIS_HOST Redis host (enables shared cache if set) โ€”
REDIS_PORT Redis port 6379
REDIS_DB Redis database index 0

Deployment-centric variable (container only):

  • UVICORN_WORKERS: number of Uvicorn workers; 0 or unset = auto based on CPU (entrypoint.sh)

๐Ÿ“ก Stremio Manifest & Catalog URLs

All URLs are derived from the encrypted config token and adult flag.

  • Default combined manifest:
    • /config/{CONFIG}/adult/{0|1}/manifest.json
  • Movies-only manifest:
    • /config/{CONFIG}/adult/{0|1}/movie/manifest.json
  • Series-only manifest:
    • /config/{CONFIG}/adult/{0|1}/series/manifest.json
  • AI-curated catalogs (movies & series):
    • /config/{CONFIG}/adult/{0|1}/catalog/{movie|series}/{catalog_id}.json
    • /config/{CONFIG}/adult/{0|1}/catalog/{movie|series}/{catalog_id}/skip={N}.json
    • /config/{CONFIG}/adult/{0|1}/catalog/{movie|series}/{catalog_id}/search={QUERY}.json

Split-manifest routes (when using movie- or series-specific manifests in Stremio) are also supported via a compatibility prefix segment and map to the same handlers:

  • /config/{CONFIG}/adult/{0|1}/{content_type_extra}/catalog/{movie|series}/{catalog_id}.json
  • /config/{CONFIG}/adult/{0|1}/{content_type_extra}/catalog/{movie|series}/{catalog_id}/skip={N}.json
  • /config/{CONFIG}/adult/{0|1}/{content_type_extra}/catalog/{movie|series}/{catalog_id}/search={QUERY}.json

Use the preview page to copy exact URLs tailored to your config.


๐Ÿ› ๏ธ Web UI & API Endpoints

Web UI:

  • GET / โ€” Home
  • GET /configure โ€” New configuration form
  • GET /configure?config=... โ€” Edit existing configuration
  • POST /save-config โ€” Validate and return manifest + preview URLs
  • GET /config/{config}/adult/{adult}/preview โ€” Human preview with all manifest URLs
  • GET /config/{config} โ€” Redirect to /configure?config=...
  • GET /config/{config}/adult/{adult}/{content_type}/configure โ€” Redirect to /configure?config=...

Stremio API:

  • GET /config/{config}/adult/{adult}/manifest.json โ€” Combined manifest
  • GET /config/{config}/adult/{adult}/movie/manifest.json โ€” Movie manifest
  • GET /config/{config}/adult/{adult}/series/manifest.json โ€” Series manifest
  • GET /config/{config}/adult/{adult}/catalog/{movie|series}/{catalog_id}.json โ€” Catalog entries
  • GET /config/{config}/adult/{adult}/catalog/{movie|series}/{catalog_id}/skip={N}.json โ€” Catalog pagination (Redis optimized)
  • GET /config/{config}/adult/{adult}/catalog/{movie|series}/{catalog_id}/search={QUERY}.json โ€” Catalog search (TTL cached)
  • Split-manifest equivalents with the extra segment {content_type_extra} for the three catalog endpoints above

๐Ÿ” Security & Config Storage

  • AES-256 GCM encryption + PBKDF2
  • Configuration embedded in URL โ€” no server-side storage
  • Your API keys are not stored server-side

๐ŸŽญ Split Manifest Support

Available via configuration. Choose a single addon or split into:

  • Movies-only addon
  • Series-only addon
  • Combined addon

๐Ÿงช Testing

pip install -r requirements-dev.txt
pytest
pytest --cov=app

๐Ÿค Contributing

Contributions welcome โ€” follow the standard GitHub workflow!

  1. Fork ๐Ÿ“Œ
  2. Create a new feature branch ๐Ÿšง
  3. Make changes and test thoroughly ๐Ÿงช
  4. Create a pull request ๐Ÿ”„

Please ensure test coverage for new features.


๐Ÿ“„ License

MIT โ€” See LICENSE


๐Ÿ™ Acknowledgments

About

๐ŸŽฌ Your AI-powered movie discovery companion for Stremio

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages