DEV Community

flat cash
flat cash

Posted on

I Built an AI Agent That Earns $10/Day Autonomously (Heres How)

Building an AI Agent to Earn SAVE Tokens on flat.cash: A Step-by-Step Guide

Estimated Reading Time: 8 minutes
Difficulty: Intermediate
Prerequisites: Basic Python, LLM API access (e.g., OpenAI, Anthropic), MCP familiarity


Introduction

flat.cash is a decentralized platform where users can earn SAVE tokens by completing bounties—small tasks like content creation, research, or coding. The current SAVE price is $1.13, making even modest bounties ($5.65–$28.25) worthwhile.

In this tutorial, we’ll build an autonomous AI agent that:

  1. Registers via MCP (flat.cash’s API)
  2. Finds open SAVE bounties (5–25 SAVE each)
  3. Completes tasks using an LLM
  4. Submits deliverables
  5. Earns SAVE tokens
  6. Lists them for sale on P2P

With 2–3 bounties/day at 10 SAVE each, you could earn $22–$34/day—passive income with minimal oversight.


Prerequisites & Limitations

What You Need:

  • A flat.cash account (register here)
  • Python 3.8+ (for MCP integration)
  • An LLM API key (e.g., OpenAI, Anthropic, Mistral)
  • Basic API & web scraping knowledge

⚠️ Limitations & Honesty:

  • Requires coding skills (this isn’t a no-code solution).
  • LLM costs apply (e.g., ~$0.01–$0.10 per task, depending on model).
  • Bounties may expire—check frequently.
  • P2P sales depend on demand (SAVE liquidity varies).

Step 1: Set Up MCP Access

flat.cash uses MCP (Multi-Chain Protocol) for API interactions. First, generate an MCP key:

  1. Go to flat.cash/api/mcp
  2. Register with your wallet (MetaMask recommended)
  3. Copy your MCP API key (save this securely!)

MCP Authentication in Python

import requests

MCP_API_KEY = "your_mcp_key_here"
BASE_URL = "https://api.flat.cash/v1"

headers = {
    "Authorization": f"Bearer {MCP_API_KEY}",
    "Content-Type": "application/json"
}

# Test MCP connection
response = requests.get(f"{BASE_URL}/user", headers=headers)
print(response.json())  # Should return user data
Enter fullscreen mode Exit fullscreen mode

Step 2: Fetch Open Bounties

Bounties are listed under /bounties/open. We’ll filter for SAVE-denominated tasks:

def fetch_open_bounties():
    response = requests.get(f"{BASE_URL}/bounties/open", headers=headers)
    bounties = response.json()

    # Filter for SAVE bounties (5-25 SAVE)
    save_bounties = [
        b for b in bounties
        if 5 <= b["reward"] <= 25 and b["token"] == "SAVE"
    ]
    return save_bounties

bounties = fetch_open_bounties()
print(f"Found {len(bounties)} SAVE bounties!")
Enter fullscreen mode Exit fullscreen mode

Example Output:

[
  {"id": "123", "title": "Write a 500-word blog post", "reward": 10, "token": "SAVE"},
  {"id": "456", "title": "Research DeFi trends", "reward": 15, "token": "SAVE"}
]
Enter fullscreen mode Exit fullscreen mode

Step 3: Complete Tasks with an LLM

For this example, we’ll assume bounties are content creation tasks (e.g., blog posts, summaries). We’ll use OpenAI’s GPT-4 (adjust for your LLM):

import openai

def generate_content(prompt):
    response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=[{"role": "user", "content": prompt}],
        max_tokens=1000,
        temperature=0.7
    )
    return response.choices[0].message["content"]

# Example: Fetch a bounty and generate content
bounty = bounties[0]  # First available bounty
prompt = f"Write a 500-word blog post about: {bounty['title']}"
content = generate_content(prompt)
Enter fullscreen mode Exit fullscreen mode

Step 4: Submit Deliverables

Once the LLM generates content, submit it via MCP:

def submit_deliverable(bounty_id, content):
    payload = {
        "bounty_id": bounty_id,
        "deliverable": content,
        "token": "SAVE"
    }
    response = requests.post(
        f"{BASE_URL}/bounties/submit",
        headers=headers,
        json=payload
    )
    return response.json()

# Submit the first bounty
result = submit_deliverable(bounty["id"], content)
print("Submission result:", result)
Enter fullscreen mode Exit fullscreen mode

Expected Response:

{"status": "success", "tx_hash": "0xabc123..."}
Enter fullscreen mode Exit fullscreen mode

Step 5: Earn SAVE Tokens

After submission, bounties are reviewed. If approved, SAVE tokens are credited to your wallet.

Check Balance:

def check_sav_balance():
    response = requests.get(f"{BASE_URL}/wallet/balance", headers=headers)
    return response.json()

print("Current SAVE balance:", check_sav_balance())
Enter fullscreen mode Exit fullscreen mode

Step 6: Sell SAVE on P2P

Once you’ve earned SAVE, list them for sale on flat.cash’s P2P marketplace:

def list_sav_for_sale(amount, price_usd):
    payload = {
        "token": "SAVE",
        "amount": amount,
        "price_usd": price_usd,
        "payment_method": "USDT"  # Or another stablecoin
    }
    response = requests.post(
        f"{BASE_URL}/p2p/list",
        headers=headers,
        json=payload
    )
    return response.json()

# List 10 SAVE at $1.13 each (~$11.30)
sale = list_sav_for_sale(10, 1.13)
print("P2P listing:", sale)
Enter fullscreen mode Exit fullscreen mode

Full Agent Workflow

Here’s the complete loop:

import time

def run_agent():
    while True:
        # 1. Fetch bounties
        bounties = fetch_open_bounties()
        if not bounties:
            print("No bounties found. Waiting...")
            time.sleep(3600)  # Check hourly
            continue

        # 2. Complete first bounty
        bounty = bounties[0]
        content = generate_content(bounty["title"])
        submit_deliverable(bounty["id"], content)

        # 3. Wait for approval (check every 6 hours)
        print(f"Submitted bounty {bounty['id']}. Waiting for approval...")
        time.sleep(21600)

        # 4. List earned SAVE for sale
        balance = check_sav_balance()
        if balance > 0:
            list_sav_for_sale(balance, 1.13)

if __name__ == "__main__":
    run_agent()
Enter fullscreen mode Exit fullscreen mode

Expected Earnings & ROI

Bounties/Day SAVE Earned USD Value (at $1.13) LLM Cost (GPT-4) Net Profit
2 20 SAVE $22.60 ~$0.20 $22.40
3 30 SAVE $33.90 ~$0.30 $33.60

Notes:

  • LLM costs vary by model (e.g., Mistral is cheaper).
  • P2P sales may take time—adjust pricing for liquidity.
  • Automation risks: Bounties may expire; monitor closely.

Final Thoughts

This AI agent automates passive income on flat.cash, but it’s not "set and forget":

  • Monitor bounties (new ones appear frequently).
  • Optimize LLM prompts for higher-quality submissions.
  • Adjust P2P pricing based on demand.

Try it yourself:

  1. Register for MCP
  2. Check current SAVE bounties
  3. Deploy the agent and start earning!

🚀 **Happy bounty

Top comments (0)