DEV Community

Devon Brooks
Devon Brooks

Posted on Edited on

MCP + Code Mode Ready: Running $0.02 Deep Research and $0.05 Batch Crawls From One Metered Key

A lot of teams using Claude Code's experimental Code Mode are running into the same architectural friction: once an agent switches from serial MCP tool calls to writing parallel JavaScript fetch() scripts, an MCP-only tool setup stops helping.

If your script needs to fan out a multi-engine web search, extract clean markdown from 10 URLs with Promise.all(), transcribe a 15-minute call, and summarize the output, you are right back to:

  1. Managing 4–5 separate vendor API keys and monthly subscriptions ($19–$99/mo gates before you even run a batch).
  2. Handling silent Cloudflare/WAF HTTP 200 OK challenge pages that burn scraping credits while returning empty boilerplate.
  3. Hoping a parallel Promise.all() burst doesn't blow through your budget because there is no shared dollar cap across providers.

We built Helve to work natively over both Streamable HTTP MCP (https://helve.dev/mcp) and plain REST fetch() (https://helve.dev/v1/tools/call) behind one sk_live_ key, one prepaid USD balance ($0/mo subscription, $0.50 free starter credit, non-expiring $10/$25/$100 packs), and 313 live tools across 255 providers (291 public $0.00 tools + 22 metered commercial tools).


One Key for Both Code Mode (fetch) and MCP

In a Code Mode script, you don't need an SDK or five different auth headers—just POST https://helve.dev/v1/tools/call with your HELVE_API_KEY:

async function callHelve(tool_id, argumentsObj) {
  const res = await fetch("https://helve.dev/v1/tools/call", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.HELVE_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ tool_id, arguments: argumentsObj }),
  });

  if (res.status === 402) {
    // Agent-native 402 JSON includes topup_url, balance_usd, packs_usd
    const err = await res.json();
    throw new Error(`Spend/balance cap reached: ${JSON.stringify(err)}`);
  }
  return res.json();
}

// Fan out a multi-engine consensus search, then extract the top URLs
const search = await callHelve("helve.web_search", {
  query: "AI agent payment protocols 2026 comparison",
  provider: "fusion",
  max_results: 8,
});

const topUrls = search.data.results.slice(0, 3).map((r) => r.url);
const extracted = await callHelve("helve.web_extract", {
  urls: topUrls,
  max_chars: 8000,
});
Enter fullscreen mode Exit fullscreen mode

And if the same agent (or Claude Code / Cursor) wants to discover tools dynamically over MCP, the exact same key and balance work on https://helve.dev/mcp via search_tools + call_tool.


Concrete Cent-Priced Skill Recipes (SKILL.md Included)

Instead of guessing opaque "credit" conversions, every Helve response returns exact usage.cost_usd. We packaged three high-frequency paid workflows as live recipes—each with a machine-readable SKILL.md you can drop straight into an agent:

Workflow Tools Used Typical Cost $0.50 Starter Credit Live Recipe & SKILL.md
Deep Research Brief helve.web_search (fusion, ~$0.014) + helve.web_extract (top 3 URLs, ~$0.006) + cohere.chat ($0.000) ~$0.02 / brief ~25 briefs helve.dev/skills/deep-research
Batch Crawl & Extract (10 URLs) helve.web_extract (provider: "auto", multi-provider fallback) ~$0.05 / 10 URLs ~100 pages helve.dev/skills/batch-crawl
Audio Brief (15-min recording) POST /v1/transcriptions (~$0.075) + openrouter.chat (gpt-4o-mini, ~$0.005) ~$0.08 / 15 min ~6 briefs helve.dev/skills/audio-brief

Every $10 prepaid pack (no monthly subscription, credits never expire) buys roughly 500 deep-research briefs, 2,000 extracted pages, or 125 15-minute audio briefs—plus unlimited access to 291 $0.00 public/dev/finance tools (SEC EDGAR, GitHub, arXiv, PubMed, CoinGecko, Shodan InternetDB, NVD CVE).


Three Guardrails Built for Parallel Agent Scripts

Running parallel fetch() batches exposes three failure modes that rarely show up in single-call demos:

  1. Atomic pre-flight spend_limit_usd holds: Before forwarding to an upstream provider, Helve reserves an estimated hold atomically in Postgres (WHERE spend_limit_usd IS NULL OR spent_usd + hold <= spend_limit_usd), settles to exact usage.cost_usd once the provider responds, and releases the hold ($0.00) on failure. Parallel Promise.all() bursts cannot silently race past a key's dollar cap.
  2. Empty / WAF-blocked HTTP 200-OK guard ($0.00 billed): When a target site returns a Cloudflare/CAPTCHA challenge with HTTP 200 OK, helve.web_extract detects the blocked/empty body, automatically falls back across healthy extract providers (exa -> tavily -> parallel -> firecrawl), and charges $0.00 for blocked or failed attempts.
  3. Agent-native HTTP 402 JSON: Whether you hit a key's spend_limit_usd or exhaust your balance, both REST and MCP return structured HTTP 402 JSON (topup_url, balance_usd, packs_usd) so the script halts cleanly instead of retrying into a timeout loop.

If you are comparing agent tool gateways for Code Mode or MCP, we also keep live side-by-side breakdowns up to date at helve.dev/compare/firecrawl and helve.dev/compare/treg.

Curious how others are wiring paid APIs into Claude Code's Code Mode scripts—are you calling REST directly from generated JS, bridging back into MCP, or running a local proxy for key scoping?

Top comments (0)