Important
This repository is archived. I highly recommend Stremio AI Search or AIOMetadata to continue using LLMs for content search.
๐ฌ 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.
- ๐ง โ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)
pip install -r requirements.txt- ๐โ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)
python main.py
# or with uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000- Visit http://localhost:8000
- Click "Configure Your AI Companion"
- Enter API keys and preferences
- Copy the generated manifest URL
- Paste it into Stremio as a new addon
- Describe what you want to watch.
- AI understands your request, extracts intent.
- Suggests clever matches using natural language & GPT-style models.
- Metadata enriched with TMDB for movies and TV.
- 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โ
docker run -d \
-p 8000:8000 \
-e ENCRYPTION_KEY="your-strong-key" \
ghcr.io/willtho89/stremio-ai-companion:latestOptional 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 up -dCreate 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=0Note: The compose file also supports UVICORN_WORKERS for multi-worker deployments inside the container. If unset or 0, it auto-scales based on CPU.
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)
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:
- 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
- AES-256 GCM encryption + PBKDF2
- Configuration embedded in URL โ no server-side storage
- Your API keys are not stored server-side
Available via configuration. Choose a single addon or split into:
- Movies-only addon
- Series-only addon
- Combined addon
pip install -r requirements-dev.txt
pytest
pytest --cov=appContributions welcome โ follow the standard GitHub workflow!
- Fork ๐
- Create a new feature branch ๐ง
- Make changes and test thoroughly ๐งช
- Create a pull request ๐
Please ensure test coverage for new features.
MIT โ See LICENSE
- Stremio โ media discovery reimagined
- stremio-ai-search - inspiration for this addon
- TMDB โ open movie & TV metadata platform
- OpenRouter โ model routing + GPT ecosystem
- RatingPosterDB โ cinematic posters
- OpenAI โ large language models
