KosmoKrator

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, configure, and verify
# 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.

KeyEnv varTypeRequiredLabel
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.

Generic CLI call
kosmo integrations:call reddit.reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json
Provider shortcut
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.

Discovery commands
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 write
Parameters
parent, text
Generic call
kosmo integrations:call reddit.reddit_create_comment '{"parent":"example_parent","text":"example_text"}' --json
Shortcut
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 write
Parameters
subreddit, title, kind, text, url, nsfw, spoiler
Generic call
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
Shortcut
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 read
Parameters
none
Generic call
kosmo integrations:call reddit.reddit_get_current_user '{}' --json
Shortcut
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 read
Parameters
subreddit, post_id
Generic call
kosmo integrations:call reddit.reddit_get_post '{"subreddit":"example_subreddit","post_id":"example_post_id"}' --json
Shortcut
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 read
Parameters
subreddit
Generic call
kosmo integrations:call reddit.reddit_get_subreddit '{"subreddit":"example_subreddit"}' --json
Shortcut
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 read
Parameters
subreddit, post_id, limit, sort, depth
Generic call
kosmo integrations:call reddit.reddit_list_comments '{"subreddit":"example_subreddit","post_id":"example_post_id","limit":1,"sort":"example_sort","depth":1}' --json
Shortcut
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 read
Parameters
subreddit, sort, limit, after, before
Generic call
kosmo integrations:call reddit.reddit_list_posts '{"subreddit":"example_subreddit","sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json
Shortcut
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 read
Parameters
sort, limit, after, before
Generic call
kosmo integrations:call reddit.reddit_list_subreddits '{"sort":"example_sort","limit":1,"after":"example_after","before":"example_before"}' --json
Shortcut
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 read
Parameters
query, type, sort, time, limit, after
Generic call
kosmo integrations:call reddit.reddit_search '{"query":"example_query","type":"example_type","sort":"example_sort","time":"example_time","limit":1,"after":"example_after"}' --json
Shortcut
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
Schema command
kosmo integrations:schema reddit.reddit_create_comment --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema reddit.reddit_create_post --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema reddit.reddit_get_current_user --json
ParameterTypeRequiredDescription
No parameters.
reddit.reddit_get_post 2 parameters
Schema command
kosmo integrations:schema reddit.reddit_get_post --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema reddit.reddit_get_subreddit --json
ParameterTypeRequiredDescription
subreddit string yes Subreddit name (without r/ prefix).
reddit.reddit_list_comments 5 parameters
Schema command
kosmo integrations:schema reddit.reddit_list_comments --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema reddit.reddit_list_posts --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema reddit.reddit_list_subreddits --json
ParameterTypeRequiredDescription
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).

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.