Skip to content

fix: report missing key permissions and hook up OpenRouter speech - #437

Merged
ProfSynapse merged 1 commit into
mainfrom
fix/provider-scope-errors-openrouter-audio
Nov 5, 2026
Merged

ProfSynapse merged 1 commit into
mainfrom
fix/provider-scope-errors-openrouter-audio

Conversation

@ProfSynapse

Copy link
Copy Markdown
Owner

Summary

Readable provider errors, in one place. Obsidian's requestUrl throws on non-2xx and discards the body, so a key missing a scope reached tools as Request failed, status 401. Jest's mock returns the failure instead of throwing, so the status !== 200 branches looked covered and never ran in production.

  • New ProviderHttpClient.requestOk keeps the provider's explanation. Speech, transcription, OpenRouter video and the ElevenLabs tools use it. Chat and image tools already used this client, so they get the new wording too.
  • A key missing a permission now reads differently from a wrong key, because the fixes are opposite: ElevenLabs accepted the API key, but it is missing the text_to_speech permission… vs ElevenLabs did not accept the API key. Check it in Nexus settings under Apps. (HTTP 401).
  • ElevenLabs' { detail: { message } } bodies are now read.
  • A test fails on a bare requestUrl in the guarded files, and docs/BUILDING_APPS.md teaches requestOk.

OpenRouter speech now works. Models were offered but mostly failed.

  • Nexus defaulted to alloy, which many models reject with a 400. 31 models are declared with a voice from their own supported_voices.
  • Gemini and HeyGen only return PCM, and Voxtral 3.0's MP3 was unreliable. These request PCM and save WAV, and generateAudio tells agents which extension each model needs. A model the catalog hasn't met falls back to PCM once.
  • The voice picker loads each model's voices from the listing.
  • Left out: four models shutting down and three older ElevenLabs Turbo and Flash versions.

Removed dead code. The ElevenLabs textToSpeech tool was never registered. The Apps tab's Default TTS model setting only fed that tool, so it did nothing. A saved value is ignored.

Testing

  • Jest: 7,082 passed, 0 failed, 118 skipped. Lint, mobile check, npm run build, schemas:check and the registry gate pass.
  • New guards were mutation-checked: removing each one fails a test.
  • All 31 OpenRouter speech models produced audio through the shipped tool, with real requests.
  • In a test vault in the running plugin: OpenRouter ElevenLabs v4, Gemini (WAV), HeyGen (WAV), Fish and Grok; ElevenLabs direct voice, SFX, music and voice listing; and readable errors from wrong keys on OpenAI, Google, OpenRouter and ElevenLabs, plus a wrong voice. No plugin errors.

Not tested live:

  • A missing-scope error through a tool in the app, because the key now has every scope the tools use. The fixture is ElevenLabs' verbatim 401 body from a real missing-scope response, with the permission name swapped.
  • OpenAI's missing-scope wording, which comes from its documented text.
  • The voice picker's live listing, covered only with mocked data.

Worth checking in review

  • OCR and Google video keep their own error handling, and voice listings fall back to the catalog on failure. They weren't moved.
  • Saved OpenRouter speech selections with no explicit voice now get a voice from the catalog rather than alloy.
  • This includes the nexus-testing notes from the in-app run of feat: add GPT Image 2.6, key-aware media schemas and model updates #436.

🤖 Generated with Claude Code

A bare requestUrl throws on non-2xx and discards the provider's explanation,
so a key missing a scope surfaced as "Request failed, status 401". Speech,
transcription, OpenRouter video and the ElevenLabs tools now go through
ProviderHttpClient.requestOk, which keeps that explanation and tells a key
missing a permission apart from a wrong key.

OpenRouter speech models were offered but mostly failed: Nexus defaulted to a
voice other models reject and always asked for MP3, which Gemini and HeyGen
refuse. Declare 31 models with voices from their own lists and wrap PCM as WAV.

Remove the unregistered ElevenLabs textToSpeech tool and the Default TTS model
setting, which only that tool read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ProfSynapse
ProfSynapse merged commit a2c73e9 into main Nov 5, 2026
1 check passed
@ProfSynapse
ProfSynapse deleted the fix/provider-scope-errors-openrouter-audio branch November 5, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant