Skip to content

[Example] 051 — Next.js Streaming STT + TTS with Deepgram via Vercel AI SDK#103

Merged
lukeocodes merged 1 commit intomainfrom
example/051-nextjs-vercel-ai-sdk-streaming
Apr 2, 2026
Merged

[Example] 051 — Next.js Streaming STT + TTS with Deepgram via Vercel AI SDK#103
lukeocodes merged 1 commit intomainfrom
example/051-nextjs-vercel-ai-sdk-streaming

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 1, 2026

New example: Next.js Streaming STT + TTS with Deepgram via Vercel AI SDK

Integration: Vercel AI SDK + Next.js | Language: TypeScript | Products: STT, TTS

What this shows

A full-stack Next.js 15 App Router application that captures microphone audio in the browser and streams it to Deepgram for real-time transcription (nova-3), with live interim results displayed as the user speaks. Includes text-to-speech playback using Deepgram Aura 2 via the Vercel AI SDK's provider-agnostic generateSpeech() function. Demonstrates secure temporary API key provisioning so the main key never reaches the browser.

Required secrets

None — only DEEPGRAM_API_KEY required

Closes #24


Built by Engineer on 2026-04-01

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 1, 2026

Code Review

Overall: APPROVED

Tests ran ✅

Test 1: Transcription via Vercel AI SDK...
  OK  transcription (321 chars, found: spacewalk)
Test 2: Text-to-Speech via Vercel AI SDK...
  OK  TTS (251564 bytes linear16)
Test 3: Deepgram SDK project access (for temp key creation)...
  OK  found 1 project(s)

All tests passed

Integration genuineness

Pass — The Vercel AI SDK integration is genuine:

  • @ai-sdk/deepgram provider imported and used for both generateSpeech() (TTS) and transcribe() (STT)
  • @deepgram/sdk used for manage.getProjects() and keys.createKey() to mint temporary browser keys
  • Browser opens a real WebSocket to wss://api.deepgram.com/v1/listen with nova-3
  • Tests make real API calls (exit 2 on missing credentials, not fake passes)
  • .env.example lists DEEPGRAM_API_KEY — the only credential needed since the Vercel AI SDK uses it through the provider

Code quality

  • Official Deepgram SDK used throughout — no raw HTTP calls to Deepgram
  • No hardcoded credentials; temporary browser keys have a 10-second TTL with usage:write scope only
  • Error handling covers: missing API key (both routes), WebSocket errors, TTS failures, empty transcripts
  • Credential check in tests/test.js runs before any SDK imports (lines 11–21)
  • Both API routes validate DEEPGRAM_API_KEY before proceeding
  • Clean float32↔int16 PCM conversion for both mic capture and TTS playback

Documentation

  • README covers: what you'll build, prerequisites, env vars with console links, install/run instructions, key parameters table, architecture diagram
  • .env.example present and complete

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-01

@github-actions github-actions bot added the status:review-passed Self-review passed label Apr 1, 2026
@lukeocodes lukeocodes merged commit a9ee201 into main Apr 2, 2026
2 checks passed
@lukeocodes lukeocodes deleted the example/051-nextjs-vercel-ai-sdk-streaming branch April 2, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:vercel-ai-sdk Integration: Vercel AI SDK language:typescript Language: TypeScript status:review-passed Self-review passed type:example New example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Vercel AI SDK provider example with Next.js streaming transcription

1 participant