Skip to main content
AI agent that transcribes audio files and formats transcripts.

Code

Create speech-to-text-agent.py with the code below, or save it directly from your editor.

Skill Configuration

Create skills/speech-recognition/skill.yaml:

How It Works

Audio Transcription
  • transcribe_audio: Converts audio files to text using Gemini 2.0 Flash
  • Supports MP3, WAV, OGG, M4A formats
  • Base64 encoding for multimodal API calls
  • Accurate transcription without conversational filler
Multimodal Processing
  • OpenRouter integration with Gemini 2.0 Flash
  • Base64 audio data transmission
  • MIME type detection for different formats
  • Error handling for file validation
Text Formatting
  • format_transcript: Structures raw text into clean paragraphs
  • Speaker identification (Speaker A, Speaker B, etc.)
  • Markdown formatting for readability
  • Discussion summarization capabilities

Agent Capabilities

  • Speech-to-text specialization with audio expertise
  • File path validation and processing
  • Multi-speaker conversation handling
  • Structured output with summaries

Supported Formats

  • MP3: audio/mpeg
  • WAV: audio/wav
  • OGG: audio/ogg
  • M4A: audio/mp4

Dependencies

Environment Setup

Create .env file:

Run

Try: “Transcribe the audio file at /path/to/meeting.mp3 and identify speakers”

Example API Calls

Frontend Setup

Open http://localhost:5173 and try to chat with the speech-to-text agent