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
- Confirm that
API_SERVER_ENABLED=trueandAPI_SERVER_KEYare set. - Use the official example
curlto requesthttp://localhost:8642/v1/chat/completionsfirst, and then queue the frontend. - If the browser reports an error, make up for
API_SERVER_CORS_ORIGINSit and make up for it, and don't bind the host to0.0.0.0in the first place. - 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/.