Workspace secrets and deployment secrets are two separate lists. The published app doesn't read the workspace one automatically.
Open the Publishing / Deployments pane → your deployment → Secrets, add OPENAI_API_KEY there (there's usually a button to copy them over from the workspace), then redeploy.
If you ever pick a Static deployment: those don't get secrets at all, and you shouldn't want them to, anything in a static bundle is readable by visitors.