DEV Community

Sébastien LOPEZ
Sébastien LOPEZ

Posted on

Pay-per-use text AI API with USDC micropayments on Solana

I built a text processing API that charges per request using USDC on Solana — no subscription, no monthly fee, just pay for what you use.

API: https://textai-api.overtek.deno.net

Why pay-per-use?

Most text AI APIs force you into a monthly plan. If you're building a side project or running occasional batch jobs, you're paying for unused capacity. Pay-per-use makes more sense for sporadic workloads.

The USDC angle came from wanting a payment model that works globally without credit cards, chargebacks, or country restrictions. Solana's fees are negligible (~$0.00025/tx).

Pricing

  • 1 USDC = 1,000 credits
  • Summarize: 10 credits/call
  • Keywords: 5 credits/call
  • Translate: 15 credits/call

Quick start (free demo credits included)

# Create API key — get 100 free demo credits
curl -X POST https://textai-api.overtek.deno.net/keys/create

# Summarize text
curl -X POST https://textai-api.overtek.deno.net/summarize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your long text here...", "max_sentences": 2}'

# Extract keywords
curl -X POST https://textai-api.overtek.deno.net/keywords \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your text here..."}'

# Translate (EN→FR example)
curl -X POST https://textai-api.overtek.deno.net/translate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world", "targetLang": "fr"}'
Enter fullscreen mode Exit fullscreen mode

Buy credits with USDC

# Request Solana deposit address
curl -X POST https://textai-api.overtek.deno.net/credits/buy \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"usdc_amount": 1}'
# Returns a Solana wallet address — send USDC there, then confirm with your tx signature
Enter fullscreen mode Exit fullscreen mode

Full demo script

Complete bash walkthrough on GitHub Gist: https://gist.github.com/mokchou/6643f93ff59501f93e2e26c0db4374d1

Launching on Product Hunt tomorrow — happy to answer any questions about the architecture (it runs on Deno Deploy).


Launching on Product Hunt on April 7th: https://www.producthunt.com/products/textai-api — upvotes appreciated!

Top comments (1)

Collapse
 
sbastien_lopez_399f3f6b8 profile image
Sébastien LOPEZ

Author here — a few extra details that might be useful:

API response format for /keys/create:

{"apiKey":"sk_...", "credits":100, "demo":true, "message":"API key created with 100 free demo credits (~10 summarize calls). Top up with USDC at POST /credits/buy"}
Enter fullscreen mode Exit fullscreen mode

Checking your balance:

curl https://textai-api.overtek.deno.net/credits/balance -H "Authorization: Bearer YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

The API runs on Deno Deploy (Hono framework) with a Solana devnet integration for USDC payments. Each credit purchase generates a deposit wallet address — you send USDC to it and confirm with your transaction signature.

Happy to answer questions about the architecture or payment flow. We launch on Product Hunt tomorrow (April 7) if you want to follow along.