data
Reddit CLI for AI Agents
Use the Reddit CLI from KosmoKrator to call Reddit tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Reddit CLI Setup
Reddit can be configured headlessly with `kosmokrator integrations:configure reddit`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure reddit --set access_token="$REDDIT_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor reddit --json
kosmokrator integrations:status --json Credentials
Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | REDDIT_ACCESS_TOKEN | Secret secret | yes | Access Token |
url | REDDIT_URL | URL url | no | API Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call reddit.reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json kosmo integrations:reddit reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs reddit --json
kosmo integrations:docs reddit.reddit_create_comment --json
kosmo integrations:schema reddit.reddit_create_comment --json
kosmo integrations:search "Reddit" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
reddit.reddit_create_comment
Post a comment on a Reddit post or reply to an existing comment. The comment body supports Markdown formatting. Use "t3_" prefix for post IDs or "t1_" prefix for comment IDs as the parent.
write - Parameters
- parent, text
kosmo integrations:call reddit.reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json kosmo integrations:reddit reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json reddit.reddit_create_post
Submit a new post to a subreddit. Supports text (self), link, image, and video post types.
write - Parameters
- subreddit, title, kind, text, url, nsfw, spoiler
kosmo integrations:call reddit.reddit_create_post '{"subreddit":"example_subreddit","title":"example_title","kind":"example_kind","text":"example_text","url":"example_url","nsfw":true,"spoiler":true}' --json kosmo integrations:reddit reddit_create_post '{"subreddit":"example_subreddit","title":"example_title","kind":"example_kind","text":"example_text","url":"example_url","nsfw":true,"spoiler":true}' --json reddit.reddit_get_current_user
Get the profile of the currently authenticated Reddit user. Useful for verifying credentials and displaying account information.
read - Parameters
- none
kosmo integrations:call reddit.reddit_get_current_user '{}' --json kosmo integrations:reddit reddit_get_current_user '{}' --json reddit.reddit_get_post
Get details for a specific Reddit post by subreddit and post ID. Returns the post listing and its top-level comments.
read - Parameters
- subreddit, post_id
kosmo integrations:call reddit.reddit_get_post '{"subreddit":"example_subreddit","post_id":"example_post_id"}' --json kosmo integrations:reddit reddit_get_post '{"subreddit":"example_subreddit","post_id":"example_post_id"}' --json reddit.reddit_get_subreddit
Get information about a specific subreddit including subscriber count, description, and settings.
read - Parameters
- subreddit
kosmo integrations:call reddit.reddit_get_subreddit '{"subreddit":"example_subreddit"}' --json kosmo integrations:reddit reddit_get_subreddit '{"subreddit":"example_subreddit"}' --json reddit.reddit_list_comments
List comments for a specific Reddit post. Supports sorting (best, top, new, controversial, old, q&a) and depth limiting.
read - Parameters
- subreddit, post_id, limit, sort, depth
kosmo integrations:call reddit.reddit_list_comments '{"subreddit":"example_subreddit","post_id":"example_post_id","limit":1,"sort":"example_sort","depth":1}' --json kosmo integrations:reddit reddit_list_comments '{"subreddit":"example_subreddit","post_id":"example_post_id","limit":1,"sort":"example_sort","depth":1}' --json reddit.reddit_list_posts
List posts from a subreddit or the Reddit front page. Supports hot, new, top, rising, and controversial sorting with pagination via after/before cursors.
read - Parameters
- subreddit, sort, limit, after, before
kosmo integrations:call reddit.reddit_list_posts '{"subreddit":"example_subreddit","sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json kosmo integrations:reddit reddit_list_posts '{"subreddit":"example_subreddit","sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json reddit.reddit_list_subreddits
List popular or new subreddits. Supports pagination with after/before cursors.
read - Parameters
- sort, limit, after, before
kosmo integrations:call reddit.reddit_list_subreddits '{"sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json kosmo integrations:reddit reddit_list_subreddits '{"sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json reddit.reddit_search
Search Reddit for posts, subreddits, or users. Supports filtering by type, sorting, and time range. Use this to find relevant content across Reddit.
read - Parameters
- query, type, sort, time, limit, after
kosmo integrations:call reddit.reddit_search '{"query":"example_query","type":"example_type","sort":"example_sort","time":"example_time","limit":1,"after":"example_after"}' --json kosmo integrations:reddit reddit_search '{"query":"example_query","type":"example_type","sort":"example_sort","time":"example_time","limit":1,"after":"example_after"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
reddit.reddit_create_comment 2 parameters
kosmo integrations:schema reddit.reddit_create_comment --json | Parameter | Type | Required | Description |
|---|---|---|---|
parent | string | yes | The fullname of the thing to comment on. Use "t3_{post_id}" to comment on a post, or "t1_{comment_id}" to reply to a comment. |
text | string | yes | The comment body. Supports Markdown formatting. |
reddit.reddit_create_post 7 parameters
kosmo integrations:schema reddit.reddit_create_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
subreddit | string | yes | Subreddit name (without r/ prefix). |
title | string | yes | Post title. |
kind | string | no | Post type: self (text), link, image, or video (default: self). |
text | string | no | Post body text (for self/text posts). Supports Markdown. |
url | string | no | URL (required for link posts). |
nsfw | boolean | no | Whether the post is NSFW (default: false). |
spoiler | boolean | no | Whether the post is a spoiler (default: false). |
reddit.reddit_get_current_user 0 parameters
kosmo integrations:schema reddit.reddit_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
reddit.reddit_get_post 2 parameters
kosmo integrations:schema reddit.reddit_get_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
subreddit | string | yes | Subreddit name (without r/ prefix). |
post_id | string | yes | The base36 post ID (e.g., "abc123"). |
reddit.reddit_get_subreddit 1 parameters
kosmo integrations:schema reddit.reddit_get_subreddit --json | Parameter | Type | Required | Description |
|---|---|---|---|
subreddit | string | yes | Subreddit name (without r/ prefix). |
reddit.reddit_list_comments 5 parameters
kosmo integrations:schema reddit.reddit_list_comments --json | Parameter | Type | Required | Description |
|---|---|---|---|
subreddit | string | yes | Subreddit name (without r/ prefix). |
post_id | string | yes | The base36 post ID (e.g., "abc123"). |
limit | integer | no | Maximum number of comments to return (default: 25, max: 100). |
sort | string | no | Comment sort order: best, top, new, controversial, old, q&a (default: best). |
depth | integer | no | Maximum comment depth (default: unlimited). |
reddit.reddit_list_posts 5 parameters
kosmo integrations:schema reddit.reddit_list_posts --json | Parameter | Type | Required | Description |
|---|---|---|---|
subreddit | string | no | Subreddit name (without r/ prefix). Leave empty for front page. |
sort | string | no | Sort method: hot, new, top, rising, controversial (default: hot). |
limit | integer | no | Number of posts to return (default: 25, max: 100). |
after | string | no | Fullname of a post to fetch results after (for pagination). |
before | string | no | Fullname of a post to fetch results before (for pagination). |
reddit.reddit_list_subreddits 4 parameters
kosmo integrations:schema reddit.reddit_list_subreddits --json | Parameter | Type | Required | Description |
|---|---|---|---|
sort | string | no | Sort method: popular or new (default: popular). |
limit | integer | no | Number of subreddits to return (default: 25, max: 100). |
after | string | no | Fullname of a subreddit to fetch results after (for pagination). |
before | string | no | Fullname of a subreddit to fetch results before (for pagination). |
reddit.reddit_search 6 parameters
kosmo integrations:schema reddit.reddit_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | The search query string. |
type | string | no | Result type: "link" (posts), "sr" (subreddits), "user", or comma-separated combinations. Default: "link". |
sort | string | no | Sort order: "relevance", "hot", "top", "new", or "comments". Default: "relevance". |
time | string | no | Time range: "hour", "day", "week", "month", "year", or "all". Default: "all". |
limit | integer | no | Maximum number of results (default: 25, max: 100). |
after | string | no | Pagination cursor — fullname of the last result from a previous response. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.