To get Reddit data into an LLM, use Scavio's Reddit API: POST /api/v1/reddit/search finds the threads, /api/v1/reddit/post/comments returns each thread's comments with nested replies in tree order and a depth field, and /post/comments/replies expands any branch Reddit collapses. Flatten that into indented text with the score on each line and pass it to the model. Every call costs 1 credit, about $0.002 on the Growth plan billed yearly, and needs no Reddit app or OAuth.
Reddit's own Data API is the other route, and it now requires an approved access request, a registered OAuth app and, for commercial use or AI training, explicit written approval from Reddit. If you qualify, PRAW is the standard Python client. The steps below use Scavio, and every response shown was captured on October 27, 2026.
Step 1: Search for the threads
curl -s https://api.scavio.dev/api/v1/reddit/search \
-H "Authorization: Bearer $SCAVIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "best embedding model for RAG"}'This returned 7 posts in 3.4 s, plus a next_cursor for the next 7. One row, as captured (body text trimmed):
{
"post_id": "t3_1v2ebaq",
"title": "Best embedding model for indexing ~17,000 scientific PDFs for a RAG system in 2026?",
"text": "Hi everyone,\n\nI'm building a production RAG system focused on **scientific research papers** (desalination, chemistry, membranes, engineering). ...",
"url": "https://www.reddit.com/r/Rag/comments/1v2ebaq/best_embedding_model_for_indexing_17000/",
"subreddit": "Rag",
"author": "Gintoki55",
"score": 82,
"upvote_ratio": 0.9880952380952381,
"num_comments": 60,
"created_at": "2026-07-21T10:16:56.369000+0000",
"is_nsfw": false
}Search returns the full post body, so the question is already in hand. To read a whole community instead of a query, page /api/v1/reddit/subreddit/posts with "sort": "NEW" or "TOP"; feed rows carry title, score and comment count but no body, so fetch the text with /api/v1/reddit/post.
Step 2: Pull the comment tree
curl -s https://api.scavio.dev/api/v1/reddit/post/comments \
-H "Authorization: Bearer $SCAVIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"post_id": "t3_1v2ebaq"}'The first page came back in 0.7 s. Comments arrive in tree order, so a reply follows its parent with a higher depth:
[
{
"comment_id": "t1_oyvtf9y",
"text": "Before re indexing everything, I'd also benchmark a simple Elasticsearch BM25 baseline on your own scientific queries. ...",
"author": "MashoodKiyani05",
"score": 10,
"created_at": "2026-07-21T14:50:56.547000+0000",
"depth": 0,
"reply_cursor": null
},
{
"comment_id": "t1_oyx76zw",
"text": "**Could you elaborate on that?**",
"author": "Gintoki55",
"score": 1,
"created_at": "2026-07-21T18:22:22.702000+0000",
"depth": 1,
"reply_cursor": null
},
{
"comment_id": "t1_oyxefvj",
"text": "I think they mean just using Elasticsearch - BM25 is the standard in most cases for inverted indexing. ...",
"author": "5d10_shades_of_grey",
"score": 3,
"created_at": "2026-07-21T18:53:26.977000+0000",
"depth": 2,
"reply_cursor": null
}
]Pass next_cursor back as cursor while has_more is true. This 60-comment thread took 6 pages. sort accepts TOP (the default), BEST, HOT, NEW and CONTROVERSIAL.
Step 3: Expand collapsed branches
When Reddit collapses a branch, the parent comment carries a reply_cursor instead of its replies:
curl -s https://api.scavio.dev/api/v1/reddit/post/comments/replies \
-H "Authorization: Bearer $SCAVIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"post_id": "t3_1v2ebaq", "cursor": "commenttree:07d44405,::1:d1:t1_oyumg52"}'{
"replies": [
{
"comment_id": "t1_oyx7jet",
"text": "**Thanks for** **advise** **!**",
"author": "Gintoki55",
"score": 2,
"created_at": "2026-07-21T18:23:52.174000+0000",
"depth": 1,
"reply_cursor": null
}
],
"next_cursor": null,
"has_more": false
}Across the 14 threads that search returned, 12 of 45 calls were expansions like this one, and they returned 243 comments, 127 of them replies, nested as deep as depth 6.
Step 4: Flatten the thread into compact text
JSON is a poor prompt format: keys, ids, cursors and timestamps cost tokens and carry nothing the model needs. This function fetches a whole thread, puts expanded replies under their parent, and writes one indented line per comment with its score:
import requests
API = "https://api.scavio.dev/api/v1/reddit"
HEADERS = {"Authorization": "Bearer sk_live_your_key"}
def call(path, **body):
r = requests.post(f"{API}/{path}", headers=HEADERS, json=body, timeout=60)
r.raise_for_status()
return r.json()["data"]
def fetch_tree(post_id):
comments, cursor = [], None
while True:
page = call("post/comments", post_id=post_id, **({"cursor": cursor} if cursor else {}))
comments += page["comments"]
cursor = page["next_cursor"]
if not page["has_more"] or not cursor:
break
tree = []
def add(c):
tree.append(c)
rc = c.get("reply_cursor")
while rc: # collapsed branch: expand it under this comment
page = call("post/comments/replies", post_id=post_id, cursor=rc)
for r in page["replies"]:
add(r)
rc = page["next_cursor"] if page["has_more"] else None
for c in comments:
add(c)
return tree
def to_text(post, tree):
lines = [f"# {post['title']} (r/{post['subreddit']}, score {post['score']}, {post['num_comments']} comments)"]
if post.get("text"):
lines.append(post["text"])
for c in tree:
text = (c.get("text") or "").strip()
if text in ("", "[deleted]", "[removed]"):
continue
lines.append(" " * c["depth"] + f"- [{c['score']}] " + text.replace("\n", " "))
return "\n".join(lines)Measured with the o200k_base tokenizer, the 14 threads came to 44,593 tokens as JSON with every field and 23,289 as compact text: 48% fewer, dropping only 3 comments that had no text. The scores let the model weigh a reply with 10 upvotes above one with 1.
Step 5: Ask the model
from openai import OpenAI
posts = call("search", query="best embedding model for RAG")["results"][:3]
context = "\n\n".join(to_text(p, fetch_tree(p["post_id"])) for p in posts)
client = OpenAI()
answer = client.responses.create(
model="gpt-5.5",
input="Using only these Reddit threads, which embedding models do practitioners "
"recommend for RAG over technical documents, and why? Cite the subreddit.\n\n" + context,
)
print(answer.output_text)Three threads with every comment is a few thousand tokens: the largest thread in our sample, 60 comments, was 3,656 tokens. For a RAG index, chunk per top-level comment with its replies and keep the post title on every chunk, so a retrieved reply still says what question it answers. For an agent, skip the glue code: Scavio's MCP server exposes the Reddit search and comment endpoints as tools that Claude, Cursor and other MCP clients call directly.
Why the comments are worth the extra calls
In those 14 threads the posts were 4,890 tokens and the comments 16,960, so comments held 78% of the text and replies below the top level 30%. The median thread was 5.6 times longer with its comments than the post alone. The chart and the vendor comparison are in the best Reddit data APIs for LLMs.
All 14 Reddit endpoints
| Endpoint | What it returns | Credits |
|---|---|---|
/api/v1/reddit/search | Posts by keyword with body text, score and comment count | 1 |
/api/v1/reddit/search/comments | Comments by keyword with their post and subreddit | 1 |
/api/v1/reddit/search/subreddits | Subreddits by keyword with subscriber counts | 1 |
/api/v1/reddit/search/suggestions | The terms and subreddits Reddit's search box proposes | 1 |
/api/v1/reddit/post | One post by id or URL with full body | 1 |
/api/v1/reddit/post/comments | Comments and nested replies in tree order with depth | 1 |
/api/v1/reddit/post/comments/replies | A collapsed branch under one comment | 1 |
/api/v1/reddit/subreddit | A subreddit's description and subscribers | 1 |
/api/v1/reddit/subreddit/posts | A subreddit's feed by hot, new, top, rising or controversial | 1 |
/api/v1/reddit/user | Karma, account age and profile | 1 |
/api/v1/reddit/user/posts | An account's posts | 1 |
/api/v1/reddit/user/comments | An account's comments | 1 |
/api/v1/reddit/popular | The r/popular feed | 1 |
/api/v1/reddit/trending | Trending subreddits and searches | 1 |
Before you index Reddit content
Reddit's Data API Terms grant no right to train a machine learning or AI model on Reddit content without the rightsholders' permission, and its Data API Wiki asks API users to delete content once it is deleted on Reddit. Scavio returns public data only; you remain responsible for how you store and use it. A retrieval index that refreshes threads on a schedule, rather than a frozen copy, keeps deletions out of your answers.
Getting started
- Sign up at dashboard.scavio.dev/sign-up: 50 free credits, no card required.
- Copy your API key from the dashboard.
- Send a POST to
/api/v1/reddit/searchwith your key in theAuthorizationheader, then pass apost_idto/post/comments.
Try the Reddit API free in the playground first, or read any thread as text with the free Reddit thread reader.
Reference: Reddit API overview · search · post comments · comment replies · subreddit posts
Frequently asked questions
How do I get Reddit comments into ChatGPT or Claude?
Fetch the thread's comments as JSON, flatten them into indented text with the score on each line, and put that text in the prompt. Scavio's /api/v1/reddit/post/comments returns comments and nested replies in tree order with a depth field, so indenting by depth rebuilds the conversation. Agents in Claude, Cursor and other MCP clients can call the same endpoints as tools through Scavio's MCP server.
Do I need a Reddit API key to feed Reddit into an LLM?
Not with a third-party API. Reddit's own Data API requires a registered OAuth app, an approved access request and, for commercial use, explicit written approval. Scavio needs only a Scavio API key, and new accounts get 50 free credits with no card.
Should I index Reddit comments or only posts for RAG?
Comments. In 14 Reddit threads about embedding models we pulled on October 27, 2026, the comments held 78% of the text and replies below the top level held 30%, and the median thread was 5.6 times longer with its comments than the post alone. Indexing only posts keeps the questions and drops the answers.
Can I train a model on Reddit data?
Not without permission. Reddit's Data API Terms grant no right to use Reddit content to train a machine learning or AI model without the rightsholders' permission, and its Responsible Builder Policy requires express written approval for AI training. Reading threads at question time for retrieval is a different use, but check yours against Reddit's terms with your own counsel.