Back to AI Q&A
Why does the Hermes Agent API Server fetch a 401 or CORS? First, distinguish between browser direct connection and Open WebUI direct connection

Why does the Hermes Agent API Server fetch a 401 or CORS? First, distinguish between browser direct connection and Open WebUI direct connection

AI Q&A Admin 213 views

Hermes Agent API Server reports 401 or CORS, usually not the same problem. 401 means you don't bring the right Authorization: Bearer ...; CORS only needs to be handled when the browser calls Hermes directly. For server-side docking like Open WebUI, the official documentation clearly states that CORS is generally not required at all.

Judge what kind of connection you are first

  • Open WebUI / LibreChat / LobeChat: Most of them are server-side requests to Hermes, as long as the base URL and Bearer Token are paired, and usually do not require API_SERVER_CORS_ORIGINS.
  • Whitelist such as fetch: browser direct connection in your own web page API_SERVER_CORS_ORIGINS=http://localhost:3000.

Fastest investigation sequence

  1. Confirm that API_SERVER_ENABLED=true and API_SERVER_KEY are set.
  2. Use the official example curl to request http://localhost:8642/v1/chat/completions first, and then queue the frontend.
  3. If the browser reports an error, make up for API_SERVER_CORS_ORIGINSit and make up for it, and don't bind the host to 0.0.0.0 in the first place.
  4. If you change to public access, be sure to keep the token and narrow the CORS whitelist.

In a word: 401 first checks the token, CORS first checks whether it is directly connected to the browser. Don't confuse Open WebUI with fetch errors.

Official open source address: https://github.com/NousResearch/hermes-agent; Official document entry: https://hermes-agent.nousresearch.com/.

Recommended Tools

More