DEV Community

Sébastien LOPEZ
Sébastien LOPEZ

Posted on

How I Built an AI API That Accepts USDC Payments on Solana (No Credit Card Needed)

Most AI APIs require a credit card, a subscription, and KYC verification. What if you could just send USDC on Solana and start making API calls immediately?

That's exactly what I built with TextAI API — a text processing service (summarize, extract keywords, translate) where you pay per request with USDC on Solana.

Why USDC on Solana?

  • No credit card needed — just a Solana wallet with USDC
  • No subscription — pay only for what you use
  • No KYC — start in seconds
  • Sub-cent transactions — Solana fees are negligible
  • Global access — anyone with a wallet can use it, no banking infrastructure required

How It Works

1. Get an API key (free, 100 demo credits included)

curl -X POST https://textai-api.overtek.deno.net/api/keys
Enter fullscreen mode Exit fullscreen mode

You get 100 free credits to try every endpoint before paying anything.

2. Use the API

Summarize text:

curl -X POST https://textai-api.overtek.deno.net/api/summarize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your long text here...", "length": "short"}'
Enter fullscreen mode Exit fullscreen mode

Extract keywords:

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

Translate:

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

3. Add credits with USDC

When your free credits run out, send USDC to the payment address on Solana and submit the transaction signature:

curl -X POST https://textai-api.overtek.deno.net/api/credits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"txSignature": "your_solana_tx_signature"}'
Enter fullscreen mode Exit fullscreen mode

The API verifies the SPL token transfer on-chain with anti-double-spend protection.

Tech Stack

  • Runtime: Deno + Hono.js
  • AI: Groq inference (fast, free tier available)
  • Payments: USDC (SPL token) on Solana devnet
  • Hosting: Deno Deploy
  • Anti-fraud: KV-based transaction deduplication

Why This Matters for Web3

Most AI services today are siloed behind Web2 payment rails. By accepting USDC natively, TextAI API opens up use cases for:

  • AI agents that need text processing capabilities and already hold USDC
  • DeFi protocols that want to add AI features without credit card infrastructure
  • Global developers in regions with limited banking access
  • Autonomous systems that can transact programmatically on Solana

Try It Now

The API is live and ready to use. Get your key, try the endpoints, and let me know what you build with it.


Have questions or feedback? Drop a comment below or open an issue on GitHub.

Top comments (0)