Skip to content

Bug: OpenAI Moderation works in internal chat but fails with 401 error in Flowise Chat Embed #4663

@brumur

Description

@brumur

Describe the bug
When enabling OpenAI Moderation in a Flowise flow, everything works perfectly in the internal flow chat (canvas). The moderation is processed correctly, responses are returned, and the requests appear on the OpenAI dashboard — confirming the API key is valid.

However, when using the Flowise Chat Embed, the same flow fails after the user sends a message. The AI appears to process the input, but instead of returning a response, it throws the following error:
401 Incorrect API key provided: [object *ect]

As soon as moderation is turned off on the node, the embedded chat works again as expected.

To Reproduce
1. Create a flow using a node like ChatOpenAI with “Use OpenAI Moderation” enabled.
2. Test the flow using the internal canvas chat — it works and moderation calls appear in OpenAI’s dashboard.
3. Use the same flow via Flowise Chat Embed (vanilla JS).
4. Send a message — a 401 error occurs after processing.
5. Disable moderation — the embed works again.

Expected behavior
The moderation feature should behave the same way in both the internal chat and the embedded chat, as long as the OpenAI API key is valid.

Setup
• running on cloud server (Contabo)
• Flowise Version: 3.0.3
• OS: macOS Sequoia 15.5 (local client)
• Browsers tested: Safari, Microsoft Edge, Google Chrome

Additional context
• The OpenAI API key is valid and confirmed via successful requests in the internal chat and OpenAI dashboard.
• The issue only happens in the embedded chat, and only when moderation is enabled.
• Likely related to how headers or API keys are handled during moderation in the embedded context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions