Hi,
I have a continuous error on the api-key when I call the API ‘TEXT TO SPEECH’.
this is my code
from pathlib import Path
from openai import OpenAI
client = OpenAI()
speech_file_path = Path(file).parent / “TTS-1.mp3”
response = client.audio.speech.create(
model=“tts-1”,
voice=“alloy”,
input=“Today is a wonderful day to build something people love!”
)
response.stream_to_file(speech_file_path)
I put the key in the registry but it always gives me an error
openai.AuthenticationError: Error code: 401 - {‘error’: {‘message’: 'Incorrect API key provided: sk-1ROld***********************************c8JR. You can find your API key at OpenAI Platform', ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_api_key’}}
I have also tried writing the code in other languages (like c#) but I always get the same error.
Does anyone have the same error?