Credit Optimization
Get more from your credits
Every ReddGrow API call costs credits, and Reddit reads are priced per Reddit page fetched. The biggest saving is to lower limit to what you need, because cost scales with pages. Add the right endpoint choice and a simple caching layer and you can cut your monthly usage significantly without changing what your agent can do.
Credit cost reference
| Endpoint | Credits per page | Items per page | Default (limit 25) |
|---|---|---|---|
GET /v1/reddit/jobs/{id} | 0 | 0 | |
GET /agent/subreddits/{sub}/posts | 2 | Always 1 page (about 25 posts) | 2 |
GET /agent/posts/{sub}/{id}/comments | 2 | Always 1 page | 2 |
GET /agent/subreddits/{sub}/comments | 2 | 25 | 2 |
GET /agent/users/{username}/posts | 1 | About 20 | 2 (2 pages) |
GET /agent/users/{username}/comments | 2 | 25 | 2 |
GET /agent/posts/search | 1 | 7 | 4 (4 pages) |
GET /agent/domains/{domain}/mentions | 5 | 25 | 5 |
limit defaults to 25, with a minimum of 1 and a maximum of 100, and at most 8 Reddit pages are fetched per read. Search is the most limit-sensitive read: limit=7 reserves 1 credit, limit=25 reserves 4 and limit=100 reserves 8.
Reddit reads are async jobs. Creating a job reserves the credits for the pages your limit can need, and the pages the scraper did not need are refunded when the job finishes. The final charge is creditsCharged on the finished job, and you are never charged more than the reservation. Polling the job is free. A job that fails on ReddGrow's side (503) is refunded in full; if Reddit answers 403, 404 or 429 you pay for the pages fetched (at least 1) and the rest is refunded.
Decision tree
Use this to pick the cheapest endpoint for the task.
Do you need data about a subreddit?
├── Recent posts? → posts (2 cr flat)
├── What people are saying right now? → comments (2 cr per 25)
└── Posts matching a phrase? → posts search (1 cr per 7, keep limit low)
Do you need data about a post?
├── Its comments? → posts comments (2 cr flat)
└── Don't know the post yet? → posts search (limit=7, 1 cr) → posts comments (2 cr)
Do you need to know what a user has been doing?
├── users posts (1 cr per ~20)
└── users comments (2 cr per 25)
Do you need domain mentions?
└── domains/mentions (5 cr per 25), cache aggressivelyKey optimization patterns
Lower limit to what you need
Cost scales with the number of Reddit pages a read needs, so limit is your main cost control. A search with limit=7 costs 1 credit, while limit=25 costs 4 and limit=100 costs 8. Reading a post's comments or a subreddit feed is a flat 2 credits whatever the limit, so for those ask for everything you need in one call.
Search once, then read comments
Post search returns titles and metadata only (the selftext is empty). Run one search with a small limit (7 results is 1 credit), pick the threads that matter, then read only those comment threads (2 credits each).
search limit=7 (1 cr) + comments for the 2 best threads (4 cr) = 5 credits totalPolling is free
Polling GET /v1/reddit/jobs/{id} costs 0 credits. Poll every few seconds rather than re-creating a job that looks slow. A new job is a new charge.
Response caching
Most Reddit data doesn't change minute-to-minute. Caching API responses dramatically reduces repeat costs.
| Endpoint | Recommended TTL | Reason |
|---|---|---|
posts (hot/new) | 5 minutes | Feed changes quickly |
posts (top/week) | 30 minutes | Weekly rankings are stable |
posts search | 15 minutes | Results drift gradually |
domains/mentions | 30 minutes | Mentions accumulate slowly |
Simple in-memory cache (Node.js)
Cache the finished job result, so a cache hit skips both the credit charge and the polling.
const cache = new Map();
const headers = { "x-api-key": process.env.REDDGROW_API_KEY };
async function cachedRead(key, url, ttlMs) {
const hit = cache.get(key);
if (hit && Date.now() - hit.ts < ttlMs) {
return hit.data;
}
// Create the job (credits are reserved here)
const { jobId } = await fetch(url, { headers }).then((r) => r.json());
// Poll until it finishes (free)
let job;
do {
await new Promise((r) => setTimeout(r, 3000));
job = await fetch(`https://api.reddgrow.ai/v1/reddit/jobs/${jobId}`, { headers })
.then((r) => r.json());
} while (job.status === "queued" || job.status === "running");
if (job.status === "failed") throw new Error(job.error.message);
cache.set(key, { data: job.result, ts: Date.now() });
return job.result;
}
// 5-minute TTL for a hot feed
const posts = await cachedRead(
"posts:typescript:hot",
"https://api.reddgrow.ai/agent/subreddits/typescript/posts?sort=hot",
5 * 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 * pages_per_call * credits_per_page * calls_per_day)
monthly_credits = daily_credits * 30Example: an agent that reads the hot feed of 10 subreddits per day and does 5 domain mention checks at the default limit (1 page of 25 results):
10 subreddits × 2 credits = 20 credits/day
5 domain checks × 5 credits = 25 credits/day
Total = 45 credits/day × 30 = 1,350 credits/monthThese are upper bounds, because pages a read does not need are refunded. See Pricing for plan limits.