Credit Optimization
Get more from your credits
Every ReddGrow API call costs credits. The right endpoint choice and a simple caching layer can cut your monthly usage significantly without changing what your agent can do.
Credit cost reference
| Endpoint | Cost |
|---|---|
GET /agent/subreddits/{sub}/about | 1 credit |
GET /agent/subreddits/{sub}/rules | 1 credit |
GET /agent/users/{username}/about | 1 credit |
GET /agent/subreddits/{sub}/posts | 2 credits |
GET /agent/users/{username}/posts | 2 credits |
GET /agent/users/{username}/comments | 2 credits |
GET /agent/search/posts | 3 credits |
GET /agent/subreddits/{sub}/check-url | 3 credits |
GET /agent/subreddits/{sub}/wiki/{page} | 5 credits |
GET /agent/posts/batch | 5 credits |
GET /agent/domains/{domain}/mentions | 5 credits |
Decision tree
Use this to pick the cheapest endpoint for the task.
Do you need data about a subreddit?
├── Just metadata (size, description)? → about (1 cr)
├── Posting rules? → rules (1 cr)
├── Recent posts? → posts (2 cr)
├── Deep community background? → wiki (5 cr) — only if necessary
└── Has a URL been posted before? → check-url (3 cr)
Do you need post data?
├── You have the post IDs?
│ ├── 1–5 posts? → individual lookups not available; use batch (5 cr)
│ └── 6–25 posts? → batch (5 cr)
└── You don't have IDs?
└── search (3 cr) → collect IDs → batch (5 cr)
Do you need domain mentions?
└── domains/mentions (5 cr) — cache aggressivelyKey optimization patterns
Use about before wiki
Always check the subreddit's about endpoint (1 credit) first. The description and sidebar often contain enough context. Only escalate to wiki (5 credits) when the about response is insufficient.
const about = await fetchAbout("typescript"); // 1 credit
if (about.description.length < 200) {
// Short description — fetch wiki for more context
const wiki = await fetchWiki("typescript", "index"); // 5 credits
}Search then batch instead of individual fetches
Searching returns IDs cheaply. Fetching individual posts by ID is not available as a 1-credit operation — use batch for any post detail work.
search (3 cr) + batch up to 25 posts (5 cr) = 8 credits total
vs.
search (3 cr) + 20 individual guesses = not possible, must batchParallel cheap calls beat one expensive call
Two 1-credit calls in parallel cost less than one 3-credit search when you already know the subreddit and just need metadata.
// 2 credits total, parallel
const [about, rules] = await Promise.all([
fetchAbout("typescript"),
fetchRules("typescript"),
]);Response caching
Most Reddit data doesn't change minute-to-minute. Caching API responses dramatically reduces repeat costs.
| Endpoint | Recommended TTL | Reason |
|---|---|---|
about | 1 hour | Subscriber counts change slowly |
rules | 6 hours | Rules rarely change |
wiki | 24 hours | Wiki pages are infrequently updated |
posts (hot/new) | 5 minutes | Feed changes quickly |
posts (top/week) | 30 minutes | Weekly rankings are stable |
search | 15 minutes | Results drift gradually |
check-url | 10 minutes | New posts appear infrequently |
domains/mentions | 30 minutes | Mentions accumulate slowly |
Simple in-memory cache (Node.js)
const cache = new Map();
async function cachedFetch(key, url, ttlMs) {
const hit = cache.get(key);
if (hit && Date.now() - hit.ts < ttlMs) {
return hit.data;
}
const res = await fetch(url, {
headers: { "x-api-key": process.env.REDDGROW_API_KEY },
});
const data = await res.json();
cache.set(key, { data, ts: Date.now() });
return data;
}
// 1-hour TTL for subreddit about
const about = await cachedFetch(
"about:typescript",
"https://api.reddgrow.ai/agent/subreddits/typescript/about",
60 * 60 * 1000
);For persistent caching across restarts, serialize to Redis or a local SQLite database with an expires_at column.
Estimating monthly spend
Use this formula to estimate your credit needs:
daily_credits = (calls_per_type * cost_per_type * calls_per_day)
monthly_credits = daily_credits * 30Example: an agent that researches 10 subreddits per day (about + rules each) and does 5 domain mention checks:
10 subreddits × (1 + 1) credits = 20 credits/day
5 domain checks × 5 credits = 25 credits/day
Total = 45 credits/day × 30 = 1,350 credits/monthSee Pricing for plan limits.