#8402 The API key you used is missing the permission text_to_speech to execute this operation.:{'text': 'Hello, my dear friend

196.115**6 Posted at: 57 minutes ago

The API key you used is missing the permission text_to_speech to execute this operation.:
{'text': 'Hello, my dear friend, I hope every day of yours is wonderful and joyful!', 'rate': '+0%', 'role': 'Roger - Laid-Back Casual Resonant', 'filename': 'C:\Users\ayoub\AppData\Local\Temp/pyvideotrans/24-1792756867.8267477.wav', 'tts_type': 24, 'language': 'en', 'volume': '+0%', 'pitch': '+0Hz'}
Traceback (most recent call last):
File "D:\tiktok bot\pyvideotrans-main\videotrans\util\ListenVoice.py", line 21, in run

tts.run(

File "D:\tiktok bot\pyvideotrans-main\videotrans\tts\__init__.py", line 132, in run

return _cls(**kwargs).run()  # type:ignore

File "D:\tiktok bot\pyvideotrans-main\videotrans\tts\_base.py", line 125, in run

raise self.error if isinstance(self.error, Exception) else DubbingSrtError(str(self.error)+f'\n{self=}')

File "D:\tiktok bot\pyvideotrans-main.venv\lib\site-packages\tenacity\__init__.py", line 480, in call

result = fn(*args, **kwargs)

File "D:\tiktok bot\pyvideotrans-main\videotrans\tts\_elevenlabs.py", line 48, in _run

for chunk in response:

File "D:\tiktok bot\pyvideotrans-main.venv\lib\site-packages\elevenlabs\text_to_speech\client.py", line 157, in convert

with self._raw_client.convert(

File "C:\Users\ayoub\AppData\Roaming\uv\python\cpython-3.10.19-windows-x86_64-none\lib\contextlib.py", line 135, in enter

return next(self.gen)

File "D:\tiktok bot\pyvideotrans-main.venv\lib\site-packages\elevenlabs\text_to_speech\raw_client.py", line 212, in convert

yield _stream()

File "D:\tiktok bot\pyvideotrans-main.venv\lib\site-packages\elevenlabs\text_to_speech\raw_client.py", line 210, in _stream

raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

elevenlabs.core.api_error.ApiError: headers: {'date': 'Fri, 23 Oct 2026 12:01:11 GMT', 'server': 'uvicorn', 'content-length': '244', 'content-type': 'application/json', 'vary': 'Accept-Language', 'access-control-allow-origin': '', 'access-control-allow-headers': '', 'access-control-allow-methods': 'POST, PATCH, OPTIONS, DELETE, GET, PUT', 'access-control-max-age': '600', 'strict-transport-security': 'max-age=1800;', 'x-trace-id': '924da835c3937e3b85bb8c60f5140193', 'x-region': 'europe-west4', 'via': '1.1 google', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000'}, status_code: 401, body: {'detail': {'type': 'authentication_error', 'code': 'unauthorized', 'message': 'The API key you used is missing the permission text_to_speech to execute this operation.', 'status': 'missing_permissions', 'request_id': '924da835c3937e3b85bb8c60f5140193'}}


=
system:Windows-10-10.0.26200-SP0
version:v4.16
frozen:False
language:en_US
root_dir:D:/tiktok bot/pyvideotrans-main
Python: 3.10.19 (main, Feb 12 2026, 00:37:08) [MSC v.1944 64 bit (AMD64)]

1 Replies

#1 DeepSeek reply at 57 minutes ago

This is not a pyVideoTrans bug. ElevenLabs returned HTTP 401 missing_permissions, which means the API key you entered does not have the text_to_speech permission scope.

ElevenLabs API keys are scoped. When you create a key you can restrict which endpoints it may call. A key created with only read/voices scope, or a "restricted key" where Text to Speech was left unchecked, will authenticate successfully (so the voice list loads fine and you can see "Roger - Laid-Back Casual Resonant"), but every synthesis call fails with exactly this 401.

Fix:

  1. Log in at https://elevenlabs.io and open your profile → API Keys (https://elevenlabs.io/app/settings/api-keys).
  2. Either edit the existing key, or create a new one, and make sure Text to Speech (text_to_speech) is enabled in its permission scope (also keep Voices/user_read enabled so the voice list still loads).
  3. Copy the full key again — a key is only shown once at creation, and a partially copied key can also produce 401s.
  4. In pyVideoTrans open Menu → TTS Settings → Elevenlabs.io, replace the key, save, restart the software, then click Listen again to verify before running the full task.
  5. If the key already has text_to_speech enabled and it still fails, check the account's subscription/quota on the ElevenLabs dashboard — an exhausted or unsubscribed account can also return authorization errors. Also confirm the selected voice actually belongs to that account.

Note: this error is only in the voice-preview thread (ListenVoice.py). Once the key is corrected, the same voice setting will work in the normal dubbing stage.

If the problem persists after the key is confirmed to have the Text to Speech scope, provide the last ~30 lines of the newest file in the logs/ folder of D:/tiktok bot/pyvideotrans-main.

Please refer to the related documentation:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource