Repository navigation
Add bb cloud voice transcription - #4569
Conversation
The bb-ai-gateway gains POST /api/ai/v1/transcribe, which forwards base64 audio to OpenRouter's transcription endpoint with zero data retention, tries AI_TRANSCRIBE_MODELS in order, and meters against the same daily budget with a 2 cent reserve. bb-ai registers transcribe, so bb cloud joins the Voice input picker and Automatic after Codex. bb-account's fetch accepts request bodies up to 16 MB so recordings fit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8b9a0b4e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| TRANSCRIBE_TIMEOUT_MS, | ||
| signal, |
There was a problem hiding this comment.
Propagate cancellation through the hosted transcription request
When voice transcription is cancelled or reaches the server's 10-second timeout after accountFetch has started, this signal only aborts bb-ai's local plugin-RPC fetch. The bb-account RPC handler receives no abort signal, and authenticatedFetch uses an independent timeout, so the recording can continue uploading to getbb.app and be transcribed, billed, and logged after bb has told the user it was cancelled or timed out. Cancellation needs to propagate through bb-account and the gateway's upstream fetch, not just this RPC call.
Useful? React with 👍 / 👎.
…-for-inference-thr_tdbycrkh9q # Conflicts: # plans/bb-account-and-hosted-generation.md # plugins/bb-ai/app.test.tsx # plugins/bb-ai/app.tsx # plugins/bb-ai/src/disclosure.ts # plugins/bb-ai/src/server.test.ts # plugins/bb-ai/src/server.ts
The bb-cloud-ai skill, plugin overview, README, configuration guide, and verify-bb feature map still described the removed opt-in settings page. They now describe bb cloud as on by default with `bb ai off` to opt out, and cover voice input formats, limits, and model fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Human comments
What was wrong
bb cloud (the
bb-aiplugin, #4254) only served thread titles and commit messages. Voice input had no hosted option, so a bb without a Codex login had no microphone. The plan left voice as phase 2 (plans/bb-account-and-hosted-generation.md, Part 8). The bb side already had everything voice needs: the plugin SDK'stranscribehook, the Voice input row in Settings → AI services, the server's transcribe route,bb voice transcribe, and the mic's readiness check. The missing pieces were a hosted endpoint and bb-ai implementingtranscribe.What changed
apps/ai-gateway): newPOST /api/ai/v1/transcribe.{audio, format, hint}with base64 audio, capped at 10 MB, and forwards it to OpenRouter'sPOST /api/v1/audio/transcriptionswithprovider: {zdr: true, data_collection: "deny"}./completethrough onehandleMeteredpath: the same auth, rate limit, daily budget and request log. Transcription reserves 2¢ per call and settles to the reported cost.AI_TRANSCRIBE_MODELS(new, required var, set inwrangler.jsoncfor production and staging) lists the models in order. OpenRouter's transcription endpoint has nomodelsfallback, so the gateway moves to the next model when one answers with an HTTP error, all within an 8 s deadline. It never retries after a timeout.hintgoes toprovider.options.groq.prompt, the only hint option OpenRouter documents.microsoft/mai-transcribe-2, thenopenai/whisper-large-v3-turbo. Both have ZDR endpoints.bb-account.v1.fetchaccepts request bodies up to 16 MB instead of 1 MB, since base64 recordings didn't fit. Responses stay capped at 1 MB.transcribe.bb-account.v1.fetchwith a 10 s timeout.audio/webm;codecs=opusbecomeswebmand Safari'saudio/mp4becomesm4a.complete.bb aihelp, the plugin README, overview and skill,docs/configuration.md, and the verify-bb feature map now cover voice input and say recordings are never stored. (Merged with Enable bb cloud AI by default and remove its settings page #4522, which made bb cloud on by default and removed its settings page and disclosure, and docs: remove stale feature plans and redundant reports #4525, which deleted the plan doc. The model comparison that was going into the plan is below.)Model choice (OpenRouter transcription models with ZDR endpoints, 2026-09-29):
microsoft/mai-transcribe-2(Azure, about $0.0017/min at a launch price that ends 2026-12-31, #1 on FLEURS and #2 on Artificial Analysis's word-error-rate board),openai/whisper-large-v3-turbo(Groq/DeepInfra, $0.0002–0.0007/min, takes a vocabulary prompt on Groq), and Voxtral Mini Transcribe, Deepgram Nova-3 and AssemblyAI Universal-3.5 Pro.openai/gpt-transcribe,google/gemini-3.5-transcribeandx-ai/grok-stt-1.0have no ZDR endpoint.bb-cloud-aiskill, plugin overview, README,docs/configuration.mdand the verify-bb feature map still described the removed opt-in and settings page. They now say bb cloud is on by default once you sign in,bb ai offturns it off, and disabling the plugin also stops it. The skill also covers voice input: accepted formats, the 10 MB limit, the 10 s timeout, andbb voice transcribe.No server, daemon or SDK changes. No
HOST_DAEMON_PROTOCOL_VERSIONbump.Known issue, not addressed here: through OpenRouter, MAI-Transcribe 2 answers 400 for WebM and MP4 audio but accepts the same speech as Ogg or MP3. Chrome and Safari recordings therefore get transcribed by Whisper after one refused MAI call. The follow-up is either to put Whisper first in
AI_TRANSCRIBE_MODELS(config only) or to convert recordings to Ogg before upload.How you verified
pnpm exec turbo run typecheck test lint --filter=@bb/ai-gateway --filter=bb-plugin-bb-ai --filter=bb-plugin-bb-account: pass (gateway 32 tests, bb-ai 28, bb-account 59).pnpm cloud:devwith a key, pluspnpm devsigned in to a local account,bb ai on, andbb settings ai-services set voice bb):bb voice transcribeon WebM, MP3 and M4A clips returned correct transcripts in 1.0–1.6 s. The gateway log showed MAI answering MP3 and Whisper answering WebM and M4A.bb ai usagecounted the requests.main: typecheck, test and lint pass again (bb-ai 24 tests, gateway 32, bb-account 59).Rollout
Deploy the gateway (Deploy AI Gateway) before releasing bb-ai. A released bb-ai against an old gateway would show the mic and fail every recording with a 404.
🤖 Generated with Claude Code