@aiapikey/cli
v0.3.1
Published
CLI tool for the AI API Key unified X/Twitter and Reddit data API
Maintainers
Readme
@aiapikey/cli
Unified API for X/Twitter and Reddit data. Search tweets, get user profiles, fetch Reddit posts — all with one API key.
Install
npm install -g @aiapikey/cliQuick Start
# Authenticate
aiapikey login --key ua_live_xxxxxxxxxxxx
# Search X
aiapikey x search "AI agents lang:en"
aiapikey x search "build in public" --type Top --format table
# Get user info
aiapikey x user --username elonmusk
aiapikey x followers elonmusk --limit 10
# Get a tweet + its thread
aiapikey x tweet 1840123456789
aiapikey x thread 1840123456789
# Trending topics
aiapikey x trends --country UnitedStates
# Search Reddit
aiapikey reddit search "side project ideas" --subreddit startup
aiapikey reddit posts startup --sort top --time week --limit 10
aiapikey reddit comments 1abc23Commands
X / Twitter
| Command | Description |
|---|---|
| x search <query> [--type Top\|Latest\|Media] | Search tweets. Supports X operators: lang:en, from:user, since:2026-01-01 |
| x timeline <username> | Get a user's timeline |
| x tweet <id> | Get a single tweet by ID |
| x tweet-replies <id> | Get replies to a tweet |
| x retweets <id> | Get who retweeted a tweet |
| x thread <id> | Get a tweet thread |
| x user <id> or x user --username <name> | Get user profile by ID or username |
| x followers <username> | Get a user's followers |
| x following <username> | Get who a user follows |
| x media <username> | Get a user's media tweets |
| x replies <username> | Get a user's replies |
| x trends [--country <name>] | Get trending topics |
| x list-members <listId> | Get members of a list |
| x list-timeline <listId> | Get tweets from a list |
| Command | Description |
|---|---|
| reddit search <query> [--subreddit <name>] | Search posts by keyword |
| reddit subreddit <name> | Get subreddit info (subscribers, description, icon) |
| reddit posts <subreddit> [--sort hot\|new\|top] [--time week] | List subreddit posts |
| reddit comments <postId> | Get comments for a post |
Other
| Command | Description |
|---|---|
| login [--key <key>] | Save your API key |
| docs | Print command reference |
Options
All commands support:
| Flag | Description |
|---|---|
| -f, --format <format> | Output format: json (default), table, csv, markdown |
| -l, --limit <n> | Limit number of results |
| -k, --key <key> | Override API key (global flag) |
Output Formats
json (default) — structured data, ideal for piping:
aiapikey x search "AI" --format json | jq '.tweets[0].text'table — human-readable terminal output:
aiapikey x search "AI" --format tablecsv — for spreadsheets:
aiapikey reddit search "SaaS" --format csv > results.csvmarkdown — for docs and AI consumption:
aiapikey x trends --format markdownUse as SDK
import { searchX, getXUser, searchReddit } from '@aiapikey/cli';
// Search X
const results = await searchX('AI agents lang:en', 'Latest');
console.log(results.tweets[0].text);
// Get user by username
const user = await getXUser({ username: 'elonmusk' });
console.log(user.followers);
// Search Reddit
const posts = await searchReddit('side project ideas', 'startup', 10);
console.log(posts.posts[0].title);Pricing
Pay per returned result. See aiapikey.ai/pricing for details.
Get your API key at aiapikey.ai/dashboard.
Links
- API Documentation
- Pricing
- Dashboard
- llms.txt — AI-friendly API reference
