OpenAI TTS fails with "Authentication challenge without WWW-Authenticate header"

Hi,

I’m using openHAB 5.2.1 with the OpenAI Text-to-Speech add-on.

When running:

openhab:voice say “OpenHAB Test”

I get:

Request to OpenAI failed:
org.eclipse.jetty.client.HttpResponseException:
HTTP protocol violation: Authentication challenge without WWW-Authenticate header

The important part: a direct curl from inside the same openHAB Docker container works:

https://api.openai.com/v1/audio/speech

with model tts-1, voice nova and the same API key returns HTTP 200 and valid audio.

I also tried entering the API key directly in the TTS configuration instead of using an environment variable. Same result.

The issue was already present on openHAB 5.2.0 and remains after upgrading to 5.2.1.

Has anyone seen this before? Could this be related to Jetty’s HTTP client used by the TTS add-on?

weird that curl works from the same container but the binding throws that jetty WWW-Authenticate thing. in my experience that usually means something in the http client path (proxy, middleware, or a 401 shaped weird) is confusing jetty even when a raw curl is fine.

id check if openHAB has an http proxy set under network settings, and whether the OpenAI TTS add-on is somehow going through a different route than your curl. also try regenerating the api key once just to rule out a stale secret in the binding config vs env.

if curl keeps working, its probably not openai itself. probably the add-ons http client. might be worth a github issue on the openai tts add-on with that exact exception.

Thanks, I checked that.

There is no HTTP/HTTPS proxy configured in the container or in openHAB, and I also tested with the API key entered directly in the TTS service instead of using the environment variable.

The same curl request from inside the openHAB container still returns HTTP 200 and valid audio.

Also, OpenAI TTS worked for me with openHAB 5.1.1 and started failing with 5.2.x.

So this really looks like a regression in the HTTP client path rather than an OpenAI or network issue.

ahh so it worked on 5.1.1 and died on 5.2.x, that lines up with the binding/http client more than openai

jetty gets weird when something returns a 401-shaped response without WWW-Authenticate. curl just shrugs and keeps going, so same container / same key can still look fine from the shell

id probably file it on the openai tts add-on github with: ok on 5.1.1, broken 5.2.0+5.2.1, curl from the container is 200, no proxy, key hardcoded. that exception string is the useful part

temp workaround if you need voice now: a rule that shells out to curl against /v1/audio/speech and plays the file. ugly but it unblocks you while the binding catches up