# podero-reddit — Reddit posts for AI research assistants Fetches recent posts from subreddits and serves them in a form that Claude, ChatGPT and Gemini can read by opening **one link**. Use it when the assistant can't reach reddit.com directly. This guide is served live at **https://podero-reddit.nordquant.com/** (also `/readme.md`). It contains no secret. The secret is part of the private links below; whoever has a link can use the proxy. ## For AI assistants: one private link Put the subreddits you want in the link and paste a prompt like this into Claude, ChatGPT or Gemini (any language), with the private link you were given: ``` Open https://podero-reddit.nordquant.com/p//?subs=DeutschePhotovoltaik,Finanzen and read it. Follow the instructions in its Status section if some subreddits are still pending. Then summarise the topics people discuss and list the five most interesting posts with their links. ``` ### How a request plays out 1. **First request for a subreddit** (nothing cached yet): the page answers within 3 seconds and says `Status: partial — 0 of 2 subreddits ready, 2 pending`. It contains a **retry link** (`...&try=2`) and tells the assistant to open it right away. Reddit allows the proxy about one fetch per minute, so each pending subreddit takes about a minute; the proxy keeps fetching in the background whether or not the assistant retries. 2. **Retry**: the assistant opens the retry link. Subreddits that are ready are listed in full, the rest are still `Pending` with a new retry link (`try=3`, …). After 10 tries the page tells the assistant to stop and report what it has. 3. **Every night at 05:00 Europe/Vienna** the proxy refetches every feed anyone requested in the last 7 days, so the subreddits of the latest request are warm. The same link the next morning answers instantly with `Status: complete`. 4. **A new subreddit added to the link** later: the known ones come from the cache, only the new one is `Pending`, and from the next night on it is part of the nightly run too. Each retry link carries a `try=N` counter so fetchers that cache pages never hand back the old "pending" page. The counter is only an echo; the proxy does not need it. ### Links | Link | What it returns | |------|-----------------| | `/p//?subs=A,B,C` | **Digest** of the listed subreddits (names without `r/`, comma-separated or repeated `subs=`, up to 20), newest posts | | `/p//?subs=A,B&sort=top&t=week` | Same, top posts of the week (`t`: `hour`, `day`, `week`, `month`, `year`, `all`) | | `/p//r/?sort=new&limit=25` | One subreddit | | `/p//?subs=A,B&save=` | Same digest, and stores the list as `/p//d/` | | `/p//d/` | **Saved digest**: the same page from a short link | Put the whole list in one link: the assistant then makes **one** fetch instead of one per subreddit, which also keeps tool-call safety classifiers from flagging a run of repeated credential-bearing fetches. Optional `limit` (1–100, default 25) is posts per subreddit. All of these are plain text (`text/plain`), always answer HTTP 200 within a few seconds, and every link the assistant may want to open next is written out in full on the page. Keep a link under 250 characters (Claude's limit; longer ones fail with "url exceeds the maximum fetchable length"). **Long lists: use a saved digest.** Every digest page ends with a short link for exactly that list (`/p//d/<10-hex id>`), and `&save=` stores it under a readable name. Open the long link once yourself (browser or curl), then give the assistant the short one. When a digest's retry link would be over 250 characters the page hands out the short form automatically. Saved digests live in `digests.json` in the data volume and are dropped after 90 days unopened (`REDDIT_DIGEST_DAYS`). ### What a page looks like ``` # Reddit digest: r/DeutschePhotovoltaik, r/Finanzen (try 2 of 10) Generated 2026-10-21T06:00:12Z by https://podero-reddit.nordquant.com for an AI research assistant. ... ## Status: partial — 1 of 2 subreddits ready, 1 pending Ready: r/DeutschePhotovoltaik (fetched 2026-10-21T05:31:02Z) Pending: r/Finanzen (fetch started 4 s ago). Reddit allows about one fetch per minute, ... To get the pending subreddits, open exactly this link now (do not wait, do not edit it): https://podero-reddit.nordquant.com/p//?subs=DeutschePhotovoltaik,Finanzen&try=3 If that page still lists pending subreddits, open the link it gives you. Stop after 10 tries ... ## How to read this page ... ## r/DeutschePhotovoltaik — newest posts Status: 25 posts, fetched 2026-10-21T05:31:02Z 1. — u/<author>, 2026-10-21T04:12:00Z https://www.reddit.com/r/DeutschePhotovoltaik/comments/... <excerpt> ... ## r/Finanzen — newest posts Status: pending — being fetched from Reddit (fetch started 4 s ago). Open the retry link ... ## More links ... ``` Status words the assistant may see per subreddit: | State | Meaning | What the page tells the assistant | |-------|---------|-----------------------------------| | ready / fetched | Posts below | — | | cached N h ago | Older copy served while a refresh runs | Open the link again later for newer posts | | pending | Being fetched now | Open the retry link now | | unavailable | Reddit failed 3 times in a row; the proxy backs off for 15 min | Do not retry now; the next request later today or tomorrow has it | | not found | Subreddit doesn't exist, is private/banned or misspelled | Do not retry | | ignored | Not a valid name, or more than 20 subreddits | Fix the link | ### Why it is built this way Verified against the providers' fetch tools on 2026-10-21: - **No custom headers.** None of the three assistants can add an `Authorization` or `X-Key` header when it opens a link. The only place a secret can travel is the URL, so it is a path segment. - **Claude only opens links it was given verbatim.** Its web fetch tool refuses URLs the model composed itself (for example by filling a `sub=` parameter into a template), but it follows links that appear in a page it already fetched. That is why the subreddits go into the link the user pastes, and why every retry link is spelled out in full on the page. - **Assistants cannot sleep.** "Retry in 60 seconds" is meaningless to a model, so every wait is a link to open now. The 3-second answer time per request and the model's own turn time give the pacing; ten tries cover one to two minutes, enough for one or two cold subreddits. - **Fetchers give up after a few seconds** (Claude ~15–20 s, ChatGPT reportedly ~5 s) and show the model nothing but an error code for any non-200 response. The assistant pages never queue behind Reddit's one-request-per-minute limit: they serve the cache, start background fetches and explain the state in the page body. - **Fetchers cache pages** (Gemini documents an index cache), so the retry link changes on every try (`try=N`) and pages are sent with `Cache-Control: no-store`. - **Gemini does not follow nested links** with its URL-context tool, so the digest contains the posts themselves, not just instructions. - `text/plain` is the one content type all three accept (Gemini's list has no `text/markdown`); `/robots.txt` allows everything, because Claude's fetcher honours it. ## For scripts: JSON ``` GET https://podero-reddit.nordquant.com/reddit/feed?sub=<subreddit>&key=<secret> GET https://podero-reddit.nordquant.com/p/<secret>/feed?sub=<subreddit> ``` | Param | Required | Default | Notes | |---------|----------|---------|-------| | `sub` | yes | | Subreddit name only, e.g. `DeutschePhotovoltaik` (no `r/`, no URL) | | `sort` | no | `new` | `new` or `top` | | `t` | no | `day` | Time window for `sort=top`: `hour`, `day`, `week`, `month`, `year`, `all`. Ignored for `new` | | `limit` | no | `25` | 1–100 | ```bash curl -s --max-time 600 "https://podero-reddit.nordquant.com/reddit/feed?sub=DeutschePhotovoltaik&sort=top&t=week&limit=50&key=$REDDIT_PROXY_SECRET" ``` ```json { "sub": "DeutschePhotovoltaik", "sort": "new", "t": null, "status": "ok", "fetched_at": "2026-10-08T12:34:00Z", "waited_seconds": 0, "posts": [{"title": "...", "link": "https://www.reddit.com/r/.../comments/...", "author": "username", "published": "2026-10-08T09:12:00Z", "summary_html": "<raw HTML from the feed>"}] } ``` | `status` | HTTP | Meaning | What to do | |------------------|------|---------|------------| | `ok` | 200 | Posts returned | — | | `no_posts` | 200 | Feed fetched fine but had no entries | Nothing new; move on | | `not_found` | 200 | Subreddit doesn't exist, is banned, or the name is invalid | Check the spelling; don't retry | | `rate_limited` | 503 | Reddit kept refusing us, or the queue was too long to answer in time | Wait `retry_after_seconds` (also in the `Retry-After` header), then try **once** | | `upstream_error` | 502 | Reddit unreachable, blocked us, or sent garbage | Try again later, at most once | | — | 403 | `{"detail": "forbidden"}`: missing or wrong secret | Fix the secret; retrying won't help | JSON requests wait in the queue (up to ~9 minutes), so set the client timeout to at least 600 s. Results are cached for 10 minutes keyed on `(sub, sort, t, limit)`; repeats within that window are instant. Call sequentially; parallel calls only queue up. Budget: about 50 distinct feeds per hour. Feeds requested this way are part of the nightly refresh too. ## Health `GET https://podero-reddit.nordquant.com/health` (no secret): ```json {"status": "ok", "secret_configured": true, "queued": 0, "next_upstream_slot_in_seconds": 0, "registry_size": 3, "stored_feeds": 3, "persistent": true, "scheduler": {"running": true, "refresh_at": "05:00", "timezone": "Europe/Vienna", "next_run": "2026-10-22T05:00+02:00", "last_run": "2026-10-21T03:30:41Z", "last_result": {"reason": "nightly", "seconds": 131, "fetched": 3, "failed": 0, "skipped": 0}}} ``` ## Operator notes - Code: `podero-reddit/` in base-infra. Deployed via Ansible with the rest of the stack. - Secret: `REDDIT_PROXY_SECRET` in `.env`. Rotate it by editing `.env` and redeploying; every link containing the old secret stops working. Keep it URL-safe (letters/digits) and short enough that links stay under 250 characters (Claude's limit). - Storage: one JSON file per feed in the `podero_reddit_data` volume (`/data` in the container), written atomically; it is both the cache and the registry for the nightly run. A redeploy or restart loses nothing. `scheduler.json` records the last run; a container that starts with no run in the last 24 h refreshes everything right away. - Nightly run: `REDDIT_REFRESH_AT` (`HH:MM`, default `05:30`, `05:00` in compose, empty disables) in `TZ` (`Europe/Vienna` in compose). It refetches every feed requested in the last `REDDIT_REGISTRY_DAYS` (7) days, latest request first, one per minute, skipping feeds fetched in the last hour and subreddits known not to exist. 12 feeds take about 12 minutes. A container that starts with no run in the last 24 h refreshes right away. There is no configured list: what gets warmed is exactly what was requested. - Tuning: `REDDIT_FAST_WAIT` (3 s a page waits for live fetches), `REDDIT_FRESH_TTL` (20 h: pages serve the stored copy without refetching), `REDDIT_STALE_TTL` (7 d: a copy still shown while a refresh runs), `REDDIT_CACHE_TTL` (10 min, JSON endpoint), `REDDIT_MAX_SUBS` (20 per digest), `REDDIT_ERROR_BACKOFF` (15 min after 3 consecutive failures), `REDDIT_DIGEST_LIMIT` (25), `REDDIT_EXCERPT_CHARS` (400). - The secret is in request paths, so uvicorn runs with `--no-access-log` and Traefik has no access log; nothing in the app logs a path. - Prometheus job `podero-reddit` scrapes `/metrics` on the docker network; that path is not routed publicly. Alerts: `PoderoRedditDown`, `PoderoRedditSecretMissing`. Gauges `reddit_proxy_registry_size` and `reddit_proxy_last_refresh_timestamp_seconds` show the nightly run. - Unit tests: `~/.venv/bin/python -m pytest podero-reddit/test_app.py -c /dev/null`.