ReddGrowReddGrow Docs
Guides

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

EndpointCost
GET /agent/subreddits/{sub}/about1 credit
GET /agent/subreddits/{sub}/rules1 credit
GET /agent/users/{username}/about1 credit
GET /agent/subreddits/{sub}/posts2 credits
GET /agent/users/{username}/posts2 credits
GET /agent/users/{username}/comments2 credits
GET /agent/search/posts3 credits
GET /agent/subreddits/{sub}/check-url3 credits
GET /agent/subreddits/{sub}/wiki/{page}5 credits
GET /agent/posts/batch5 credits
GET /agent/domains/{domain}/mentions5 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 aggressively

Key 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 batch

Parallel 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.

EndpointRecommended TTLReason
about1 hourSubscriber counts change slowly
rules6 hoursRules rarely change
wiki24 hoursWiki pages are infrequently updated
posts (hot/new)5 minutesFeed changes quickly
posts (top/week)30 minutesWeekly rankings are stable
search15 minutesResults drift gradually
check-url10 minutesNew posts appear infrequently
domains/mentions30 minutesMentions 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 * 30

Example: 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/month

See Pricing for plan limits.