DEV Community

HAL GOBVAN
HAL GOBVAN

Posted on Originally published at store.example.com

Tech-stack fingerprint and carbon-footprint APIs for AI agents (x402 paid)

Most AI agents I work with waste 30-60 seconds per page loading HTML they don't understand. They guess at the framework, can't tell if the CDN is Cloudflare or CloudFront, and have no idea if the page is bloated enough to be slow.

I shipped two new sub-cent x402 endpoints to fix both.

/api/techstack — Fingerprint any URL's stack

Drop in any URL, get back a structured fingerprint:

GET /api/techstack?url=https://stripe.com
Enter fullscreen mode Exit fullscreen mode

Returns:

{
  "detected": {
    "frameworks": ["Next.js", "Tailwind CSS"],
    "servers": ["nginx"],
    "cdn": [],
    "fonts": [],
    "analytics": [],
    "script_count": 76,
    "stylesheet_count": 5,
    "inline_script_bytes": 0,
    "external_script_hosts": ["js.stripe.com"],
    "has_react": true,
    "has_jquery": false,
    "has_gtag": true,
    "has_segment": false,
    "has_cloudflare_beacon": false
  },
  "findings": ["many_scripts (76)"]
}
Enter fullscreen mode Exit fullscreen mode

Detected patterns (heuristic regex + meta-tag scrape):

  • Frameworks: Next.js, Nuxt.js, React, Vue.js, AngularJS, Svelte, WordPress, Drupal, Ghost, Hugo, Jekyll, Tailwind, Bootstrap, Foundation
  • CDN via response headers: Cloudflare, AWS CloudFront, Vercel, Fastly, Akamai, Azure, Google Cloud CDN
  • Fonts: Google Fonts, Adobe Fonts (Typekit), Hoefler & Co, Inter (self-hosted)
  • Analytics: GA4, GTM, Segment, Plausible, Matomo, Hotjar, Mixpanel, Sentry, Cloudflare Insights
  • Libraries: jQuery, Stripe.js, Google Publisher Tag, reCAPTCHA/hCaptcha
  • Meta tags: viewport, description, theme-color, application-name
  • Resource counts: scripts, stylesheets, images, external hosts

Findings: no_known_frameworks_detected, legacy_jquery_only, heavy_inline_js, many_scripts, many_external_hosts, many_analytics.

Agent use case: pre-flight before running scrapers. If the CDN is Cloudflare, slow down. If React hydration is detected, skip the first 2s. If jQuery only, use older selectors.

/api/carbon — Page carbon footprint

Same interface, returns bytes shipped, compression ratio, CO2 per visit, and an A-F grade:

GET /api/carbon?url=https://example.com
Enter fullscreen mode Exit fullscreen mode
{
  "html_size_uncompressed_bytes": 559,
  "html_size_transferred_bytes": 559,
  "html_compression": "none",
  "html_compression_ratio": 1.0,
  "resource_counts": {"scripts": 0, "stylesheets": 0, "images": 0, "fonts_referenced": 0},
  "estimated_total_page_bytes": 559,
  "estimated_total_page_kb": 0.5,
  "co2_per_visit_grams": 0.98,
  "carbon_grade": "A",
  "carbon_label": "very clean",
  "findings": ["no_gzip_brotli_compression"]
}
Enter fullscreen mode Exit fullscreen mode

Stripe.com comes back at F (heavy) at 9.4MB total page weight and 16,904g CO2 per visit. Wikipedia is F at 1MB. example.com is A at 0.5KB.

Methodology: Sustainable Web Design v3 — 1.8g CO2 per KB transferred (rough average across green grids). Per-resource sizes are heuristic estimates: scripts 60KB avg, stylesheets 40KB, images 120KB, fonts 80KB.

Findings: large_html, no_gzip_brotli_compression, gzip_used_not_brotli, low_compression_ratio, many_images, many_scripts, many_webfonts, heavy_total_estimate, high_carbon.

Agent use case: green-tech preflight. Filter link candidates by grade. Recommend brotli upgrade if HTML > 50KB and only gzip available.

How to call these

Both are paid x402 endpoints at $0.0005 USDC per call on Base mainnet. Discovery: /.well-known/x402 (full 16-route catalog), /openapi.json (OpenAPI 3.1 spec with payment info), /llms.txt (text catalog optimized for LLM ingestion). Wallet 0xCa0a6c6Aa7A8F0D5893636CF166Ea2b44fb6500c on Base mainnet USDC. Facilitator pay.openfacilitator.io.

Pricing context

$0.0005 USDC/call = half a cent. For a research agent doing 1000 stack fingerprints on a discovery crawl, that's $0.50 — cheaper than a single LLM tool call. The signal you get back (whether to use .class vs data-testid selectors, whether the page will be slow to hydrate, whether to recommend brotli) pays for itself in saved failed-fetch retries.

Other endpoints in the catalog

Same $0.0005 tier: /api/dns, /api/whois, /api/securityheaders, /api/redirects, /api/ssl, /api/ai-tokens, /api/llms-txt, /api/dkim. Higher tiers: /api/extract ($0.005), /api/summarize ($0.005), /api/keywords ($0.002), /api/og ($0.001).

Top comments (0)