Send your Kagi key with the Bot scheme in the Authorization header, not Bearer. Bearer is the most common auth failure against the Kagi API because nearly every other search API uses it. The scheme word is literally Bot. If you get 401s with a valid key, the header scheme is the first thing to check.

Context: Kagi API reference notes (ai-tools kagi-search api-reference.md): authentication uses the Bot scheme in the Authorization header - the header value is the word Bot followed by your key, not the Bearer scheme nearly every other search API uses.