DEV Community

George Kioko
George Kioko

Posted on

Two APIs I Built This Week That Cost Nothing to Run

Most APIs have a dirty secret in their pricing: the upstream service they call costs money, and that cost gets passed to you plus margin. LLM based APIs charge you for tokens. Geocoding APIs charge you for lookups. Data enrichment APIs charge you for the enrichment source.

I wanted to build APIs where the underlying operation costs literally zero. Here are two I shipped this week.

API 1: DNS Record Checker

Node.js ships with a built in dns module. It can resolve A records, MX records, CNAME, TXT, NS, and more. No external API call needed. No third party service. The DNS resolution happens through the operating system's resolver, which is free.

import dns from 'dns/promises';

const records = await dns.resolveAny('example.com');
// Returns A, AAAA, MX, TXT, NS, SOA records
Enter fullscreen mode Exit fullscreen mode

That's it. Zero dependency, zero API cost, zero rate limits from upstream providers.

The actor wraps this into a clean JSON API. Pass it a domain, get back every DNS record type with TTLs, priorities for MX records, and SPF/DKIM/DMARC validation. The whole thing runs on Apify's Standby infrastructure so it responds in under a second.

Use cases that keep coming up: automated domain verification for SaaS onboarding, email deliverability checks (MX + SPF + DKIM in one call), security audits scanning for misconfigured DNS, and monitoring tools that alert when records change unexpectedly.

API 2: Sentiment Analysis

The common approach to sentiment analysis is sending text to an LLM and paying per token. That works but it's expensive at scale and adds latency.

Instead I used a word level lexicon approach. The API scores text using a pre built dictionary of ~7,000 words with known sentiment values. No LLM call. No external API. The scoring runs entirely in memory on the Node.js process.

// Simplified version of the scoring logic
const score = words.reduce((sum, word) => {
  return sum + (lexicon[word] || 0);
}, 0) / words.length;
Enter fullscreen mode Exit fullscreen mode

The result includes an overall sentiment score, confidence level, and breakdown of positive vs negative word matches. It handles negation ("not good" scores negative) and intensifiers ("very good" scores higher than "good").

Is it as nuanced as GPT? No. But for brand monitoring, review analysis, social media tracking, and content moderation at scale, a deterministic lexicon approach that returns in 50ms beats a 2 second LLM call that costs 10x more.

The pattern worth noticing

Both of these APIs follow the same principle: use what's already built into the runtime or ship a static dataset with the code. No external dependencies that cost money per call.

This matters because of what I've seen with my existing domain tools. The WHOIS Lookup actor has power users running 262 lookups per user on average. Domain and DNS tools get embedded in automated workflows and run at high volume. When your per call cost is zero, your margin stays healthy no matter how much a single user hammers the API.

Pricing

DNS Record Checker: $0.003 per lookup. Sentiment Analysis: $0.003 per text analysis. Both running on Apify Standby mode for instant responses.

The infrastructure cost is just Apify compute time. No upstream API bills eating into revenue.

Try them on Apify:


Built in Nairobi. 52 actors, zero external API costs on these two. Comments and questions welcome.

Top comments (0)