reddit-trend-visualizer
Reddit Trend Visualizer
Fetches trending posts from any subreddit, analyzes the dominant themes and mood, then generates an AI artwork that captures the subreddit's current vibe using Nano Banana image generation.
What This Skill Does
- Fetches posts from a user-specified subreddit (hot, new, or rising)
- Analyzes themes by reading titles, flair, scores, and comment counts to identify what the community is buzzing about
- Crafts a prompt that distills the subreddit's current mood into a visual description
- Generates an AI image via Nano Banana that represents the subreddit's trending vibe
- Presents results with a summary of the top posts alongside the generated image
Usage
The user says something like:
- "Visualize what r/technology is talking about right now"
- "Show me the vibe of r/cats"
- "Generate art from r/space trending posts"
- "What's the mood on r/worldnews today?"
Workflow
Step 0 — Prerequisites
Ensure the FluxA Wallet CLI is installed and the agent is registered:
npm install -g @fluxa-pay/fluxa-wallet
fluxa-wallet init --name "RedditTrendVisualizer" --client "Claude Code Skill v1.0"
Verify status:
fluxa-wallet status
Step 1 — Fetch Subreddit Posts (Free)
Call the Subreddit Posts API to get trending posts. This endpoint is free.
SUBREDDIT="technology" # user-provided subreddit name
SORT="hot" # hot, new, or rising
POSTS=$(curl -s "https://proxy-monetize.fluxapay.xyz/api/subreddit-posts/2c8cab4f/getPostsBySubreddit?subreddit=$SUBREDDIT&sort=$SORT" \
-H "X-Skill-Name: reddit-trend-visualizer" \
-H "X-Task-Id: task-$(date +%s)")
The response contains data.posts[] with fields like title, score, num_comments, link_flair_text, selftext, domain, and url.
Step 2 — Analyze Themes
Parse the top 10-20 posts from the response. Extract:
- Titles — the main topics being discussed
- Flair tags — category labels (e.g., "Artificial Intelligence", "Privacy", "Space")
- Scores and comment counts — what's generating the most engagement
- Domains — what sources the community shares
Synthesize these into:
- A theme summary (2-3 sentences describing what the subreddit is focused on)
- A visual prompt (a detailed image generation prompt that captures the mood, topics, and energy of the subreddit)
Prompt crafting guidelines:
- Reference specific topics from the posts (e.g., "AI ethics debate", "space telescope discovery")
- Set a mood that matches the community tone (excited, concerned, playful, serious)
- Use art direction words (cinematic, surreal, vibrant, atmospheric, editorial illustration)
- Keep the prompt under 200 words for best results
Step 3 — Create Spending Mandate
Before generating the image, create an intent mandate for the Nano Banana API ($0.10 per image):
MANDATE_RESULT=$(fluxa-wallet mandate-create \
--desc "Spend up to 0.10 USDC for Reddit trend visualization image generation" \
--amount 100000 \
--seconds 3600)
Extract the mandateId and authorizationUrl:
MANDATE_ID=$(echo "$MANDATE_RESULT" | jq -r '.data.mandateId')
AUTH_URL=$(echo "$MANDATE_RESULT" | jq -r '.data.authorizationUrl')
Ask the user to authorize the mandate:
- Present options: "Yes, open the link" / "No, show me the URL"
- If yes:
open "$AUTH_URL" - Wait for the user to confirm they signed
Verify the mandate is signed:
fluxa-wallet mandate-status --id "$MANDATE_ID"
Wait until mandate.status is "signed".
Step 4 — Generate Image via Nano Banana (Paid — $0.10)
Call the Nano Banana image generation endpoint. It will return HTTP 402.
IMAGE_PROMPT="A surreal digital artwork representing the current mood of r/$SUBREDDIT..."
RESPONSE=$(curl -s -w "\n%{http_code}" \
-X POST "https://proxy-monetize.fluxapay.xyz/api/nano-banana/2c8cab4f/gen-image" \
-H "Content-Type: application/json" \
-H "X-Skill-Name: reddit-trend-visualizer" \
-H "X-Task-Id: task-$(date +%s)" \
-d "{\"contents\":[{\"parts\":[{\"text\":\"$IMAGE_PROMPT\"}]}]}")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n -1)
If HTTP 402, make the x402 payment:
if [ "$HTTP_CODE" = "402" ]; then
# Pay using the mandate
PAY_RESULT=$(fluxa-wallet x402-v3 \
--mandate "$MANDATE_ID" \
--payload "$BODY")
XPAYMENT=$(echo "$PAY_RESULT" | jq -r '.data.xPaymentB64')
# Retry with payment header
IMAGE_RESULT=$(curl -s \
-X POST "https://proxy-monetize.fluxapay.xyz/api/nano-banana/2c8cab4f/gen-image" \
-H "Content-Type: application/json" \
-H "X-Payment: $XPAYMENT" \
-H "X-Skill-Name: reddit-trend-visualizer" \
-d "{\"contents\":[{\"parts\":[{\"text\":\"$IMAGE_PROMPT\"}]}]}")
fi
Step 5 — Present Results
Display to the user:
- Subreddit summary — "Here's what r/{subreddit} is buzzing about right now:"
- Top posts list — Show the top 5 posts with title, score, and comment count
- Theme analysis — 2-3 sentences describing the dominant themes
- Generated image — The AI-generated artwork capturing the subreddit's vibe
- Image prompt used — Show the prompt so the user can iterate
If the image response contains a URL or base64 image data, display or save it accordingly.
Cost Breakdown
| Step | API | Cost |
|---|---|---|
| Fetch posts | Subreddit Posts | Free |
| Generate image | Nano Banana 2.5 | $0.10 USDC |
| Total per use | $0.10 USDC |
For higher quality images, use the /gen-image-pro endpoint (Nano Banana 3) at the same $0.10 price.
tools
-
Subreddit posts
- name: pay-per-use-based subreddit-posts
- access: agent-pay
- usage:
** API Discovery ** First, discover available endpoints by making a GET request to the base URL: curl https://proxy-monetize.fluxapay.xyz/api/subreddit-posts/2c8cab4f ** Fetch posts ** GET request with subreddit name and optional sort: curl "https://proxy-monetize.fluxapay.xyz/api/subreddit-posts/2c8cab4f/getPostsBySubreddit?subreddit=<SUBREDDIT>&sort=<hot|new|rising>" Response shape: { "success": true, "data": { "cursor": "...", "posts": [{ "data": { "title": "...", "score": 123, "num_comments": 45, "link_flair_text": "...", "selftext": "...", "url": "...", "author": "...", "created_utc": 1234567890 } }] } }
-
Nano Banana
- name: pay-per-use-based nano-banana
- access: agent-pay
- usage:
** API Discovery ** First, discover available endpoints by making a GET request to the base URL: curl https://proxy-monetize.fluxapay.xyz/api/nano-banana/2c8cab4f ** Generate image ** POST request with text prompt: curl -X POST "https://proxy-monetize.fluxapay.xyz/api/nano-banana/2c8cab4f/gen-image" \ -H "Content-Type: application/json" \ -d '{"contents":[{"parts":[{"text":"Your image prompt here"}]}]}' ** Generate image (pro) ** POST request with text prompt using Nano Banana 3: curl -X POST "https://proxy-monetize.fluxapay.xyz/api/nano-banana/2c8cab4f/gen-image-pro" \ -H "Content-Type: application/json" \ -d '{"contents":[{"parts":[{"text":"Your image prompt here"}]}]}' Both endpoints cost $0.10 and require x402 payment (HTTP 402 flow).
-
Make X402 payment: see ./fluxa-wallet/X402-PAYMENT.md
notes for tools use
- If the invoked tool's access is agent-pay, it means the tool is accessed by the agent on a pay-per-use basis. The agent needs to handle x402 payment flow to use these tools. See ./fluxa-wallet/SKILL.md for the complete payment wallet documentation.
- For x402 payment details, refer to ./fluxa-wallet/X402-PAYMENT.md
- For payout operations, refer to ./fluxa-wallet/PAYOUT.md
- For payment link operations, refer to ./fluxa-wallet/PAYMENT-LINK.md
Error Handling
| Error | Meaning | Action |
|---|---|---|
| Subreddit returns empty posts | Subreddit doesn't exist or has no posts | Ask user to verify the subreddit name |
mandate_not_signed |
User hasn't signed the mandate yet | Ask user to open the authorizationUrl |
mandate_expired |
Time window passed | Create a new mandate with mandate-create |
mandate_budget_exceeded |
Budget exhausted | Create a new mandate with higher --amount |
agent_not_registered |
No Agent ID configured | Run fluxa-wallet init first |
Invalid payload: missing accepts array |
Incomplete 402 payload passed to x402-v3 | Pass the full HTTP 402 response body including the accepts array |
| Image generation fails | Nano Banana API error | Retry with a simpler prompt or try /gen-image-pro |