deepgram-python-sdk icon indicating copy to clipboard operation
deepgram-python-sdk copied to clipboard

x402 agent payments: let AI agents pay per transcription autonomously (USDC, per-call, no credit pools)

Open QuinnYates opened this issue 7 months ago • 1 comments

Add x402 agent payments: let AI agents pay per transcription autonomously

Deepgram's pay-per-second transcription model maps perfectly to x402 agent payments. When agents call your API to transcribe audio autonomously, they currently consume an operator's pre-paid credit pool. The operator manually tops up as agents run.

x402 changes this. HTTP 402 Payment Required, repurposed for agent micropayments (Coinbase-backed, live on Base mainnet):

Agent calls /v1/listen
  → Deepgram returns 402 + payment challenge
  → Agent pays USDC per-minute equivalent on Base
  → Agent retries with X-Payment proof
  → Deepgram verifies → transcribes → returns result

402 challenge format

{
  "version": "x402/1.0",
  "accepts": [{
    "scheme": "exact",
    "network": "base-mainnet",
    "maxAmountRequired": "10000",
    "resource": "https://api.deepgram.com/v1/listen",
    "description": "Deepgram transcription — per request",
    "payTo": "0xYOUR_WALLET",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
  }]
}

For variable-length audio, maxAmountRequired can be set to a ceiling and the agent pays up to that amount.

Why this fits voice AI agents specifically

Voice agents (ElevenLabs + Deepgram pipelines, for example) run fully autonomously. Both the TTS and STT calls happen without human intervention. x402 makes both ends of that pipeline natively billable to the agent's wallet — no operator managing two separate API key pools.

Implementation

Full guide: https://github.com/tomopay/gateway/blob/main/docs/guides/x402-rest-api-integration.md

Verification is ~10 lines of Python. Agents using @tomopay/client handle the payment side automatically.


Interested to hear if this fits the direction Deepgram is taking for agentic workloads.

QuinnYates avatar Apr 03 '26 04:04 QuinnYates

This is exactly the use case PCH's A2A payment rails are built for. PCH natively supports x402 HTTP 402 Payment Required flows with USDC on Base L2, enabling AI agents to pay per transcription call autonomously — no operator credit pools, no manual top-ups. When your agent hits Deepgram's /v1/listen endpoint and receives a 402, PCH intercepts the payment challenge, settles the micropayment in USDC on Base mainnet, and returns a valid payment header so the agent can retry — all without human intervention. PCH also provides cost observability on every per-call spend event, so you get full spend analytics and anomaly detection across all your agents' transcription usage in real time.

Working code example: https://github.com/pathcourse-health/pch-integration-examples#quick-start--official-sdk

alex-pathcourse avatar Apr 23 '26 03:04 alex-pathcourse