# `valstorm-plugin-deepgram` — Deepgram Nova-3 Speech-to-Text & Diarization Plugin (`FI-473`) Python plugin for **Open Valstorm**, mounted at `platform.deepgram` (`VALSTORM_PLUGINS=deepgram` or `*`). Provides: - **Ephemeral 10-Minute STT Token Minting**: Issues scoped temporary keys (`GET /v1/deepgram/token` & `/v1/ai/speech/deepgram/token`) so browser/desktop clients can open live Deepgram WebSockets without exposing the master API key. - **Speaker-Diarized Nova-3 Transcription**: Transcribes audio uploads, URLs, or Valstorm VFS `file_id` recordings (`POST /v1/deepgram/transcribe` & `/v1/ai/recording/transcribe`) into structured utterances and `[MM:SS] Speaker N:` transcripts. --- ## 🤖 Agent-Assisted Quick Setup (Let the Valstorm Agent Set It Up) You only need a **Deepgram API Key** from [console.deepgram.com](https://console.deepgram.com/). Your **Valstorm AI Agent** can auto-discover your Deepgram `project_id`, save your encrypted credentials in `platform.credentials`, and verify live Nova-3 transcription and token minting. ### 1. Quick Human Prerequisite (60 Seconds in Deepgram Console) 1. Log in to [console.deepgram.com](https://console.deepgram.com/). 2. Create an API Key with **Member** or **Admin** scope (so it can mint 10-minute ephemeral keys) and copy it. ### 2. Copy-Paste Prompt for Your Valstorm Agent Drop this prompt into Valstorm Chat: > *"Set up `valstorm-plugin-deepgram` using my Deepgram API Key ``. Follow `plugins/valstorm-plugin-deepgram/README.md` to auto-discover my Deepgram `project_id`, save the encrypted credentials via `platform.deepgram.save_credentials(...)`, and run `deepgram_verify_connection`."* ### 3. Agent Execution Runbook (Instructions for the AI Agent) 1. **Save Credentials & Auto-Discover `project_id`**: - Call `await platform.deepgram.save_credentials(api_key=..., model="nova-3", discover_project=True)` (or `POST /v1/deepgram/credentials`). 2. **Verify Live Connection**: - Call `deepgram_verify_connection` and report the discovered `project_id` and active STT model (`nova-3`). --- ## 🛠️ End-to-End DIY Setup Guide (Manual) ```python await platform.deepgram.save_credentials( api_key="dg_xxxxxxxxxxxxxxxxxxxxxxxx", model="nova-3", ) # Mint a 10-minute scoped browser/desktop WebSocket token token_info = await platform.deepgram.mint_ephemeral_token() # Transcribe a recording stored in Valstorm VFS result = await platform.deepgram.transcribe_vfs_file(file_id="file_01HXYZ", diarize=True) ``` --- ## Running Tests ```bash cd apps/open-api .venv/bin/pytest tests/test_plugin_deepgram.py -v ```