Skip to main content
Glama
README.md
# Audio Transcription MCP

Audio transcription with OpenAI Whisper and x402 micropayments on Base.

## Features

- šŸŽ¤ **AI Speech-to-Text** - Transcribe audio files using OpenAI Whisper
- šŸ’³ **x402 Payments** - Pay $0.010 USDC per transcription via Base mainnet
- šŸŒ **Multi-Language** - Support for 50+ languages with auto-detection
- šŸ“ **Multiple Formats** - MP3, WAV, M4A, MP4, WebM, OGG, FLAC
- šŸ”— **URL Support** - Transcribe audio from URLs
- šŸ”’ **Payment Verification** - Secure payment verification via Coinbase CDP Facilitator

## Live Demo

🌐 **Service URL:** [https://audio-transcription-mcp.vercel.app](https://audio-transcription-mcp.vercel.app)

## API Endpoints

### POST /api/transcribe
Transcribe audio file (multipart/form-data upload)

**Request:**
```bash
curl -X POST https://audio-transcription-mcp.vercel.app/api/transcribe \
  -H "PAYMENT-SIGNATURE: your_payment_signature" \
  -F "file=@audio.mp3" \
  -F "language=en"
```

**Parameters:**
- `file` (required) - Audio file (max 25MB)
- `language` (optional) - Language code (e.g., en, es, fr, de, ja, zh)

**Response:**
```json
{
  "success": true,
  "text": "This is the transcribed text from the audio file.",
  "language": "en",
  "fileName": "audio.mp3",
  "fileSize": 1048576,
  "transcribedAt": "2026-09-06T10:45:00.000Z",
  "payment": {
    "verified": true,
    "amount": "0.010",
    "currency": "USDC"
  }
}
```

### POST /api/transcribe-url
Transcribe audio from URL

**Request:**
```json
{
  "url": "https://example.com/audio.mp3",
  "language": "en"
}
```

**Parameters:**
- `url` (required) - URL of the audio file
- `language` (optional) - Language code (e.g., en, es, fr, de, ja, zh)

**Response:**
```json
{
  "success": true,
  "text": "This is the transcribed text from the audio file.",
  "language": "en",
  "url": "https://example.com/audio.mp3",
  "fileSize": 1048576,
  "transcribedAt": "2026-09-06T10:45:00.000Z",
  "payment": {
    "verified": true,
    "amount": "0.010",
    "currency": "USDC"
  }
}
```

### GET /.well-known/x402
x402 Bazaar discovery endpoint (free)

### GET /mcp/tools
MCP tool metadata (free)

### GET /health
Health check endpoint (free)

## Supported Languages

English (en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Dutch (nl), Russian (ru), Chinese (zh), Japanese (ja), Korean (ko), Arabic (ar), Hindi (hi), and 40+ more.

## Supported Audio Formats

- **MP3** - MPEG audio
- **WAV** - Waveform audio
- **M4A** - MPEG-4 audio
- **MP4** - MPEG-4 container with audio
- **WebM** - WebM audio
- **OGG** - Ogg Vorbis audio
- **FLAC** - Free Lossless Audio Codec

**File size limit:** 25MB (Whisper API limit)

## Payment Details

- **Network:** Base Mainnet (eip155:8453)
- **Currency:** USDC
- **Price:** $0.010 per transcription
- **Protocol:** x402 v2 "exact" scheme
- **Payment Address:** `0xf081ee84c0d85278a6242bc265f0b312021ebeb1`

## Setup

### Prerequisites
- Node.js 18+
- OpenAI API key
- Vercel account (for deployment)

### Installation

```bash
npm install
```

### Environment Variables

Create a `.env` file:

```env
OPENAI_API_KEY=your_openai_api_key_here
X402_FACILITATOR_URL=https://api.cdp.coinbase.com/platform/v2/x402
PORT=3000
```

### Local Development

```bash
npm start
```

Server runs on http://localhost:3000

## Deployment

### Deploy to Vercel

```bash
# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Set environment variable
vercel env add OPENAI_API_KEY
```

Add your OpenAI API key when prompted.

## How x402 Payment Works

1. Agent calls `/api/transcribe` without payment
2. Server returns 402 with payment details in `PAYMENT-REQUIRED` header
3. Agent pays $0.010 USDC on Base via CDP Facilitator
4. Agent retries with `PAYMENT-SIGNATURE` header
5. Server verifies payment and transcribes audio

## Tech Stack

- **Express.js** - Web server
- **@x402/core** - Payment verification
- **OpenAI Whisper** - Audio transcription
- **Multer** - File upload handling
- **Base Mainnet** - Low-fee L2 blockchain
- **Vercel** - Serverless deployment

## License

MIT

## Support

For issues or questions, open an issue on GitHub.