Kagi API Wrapper

Enter your password to continue

Kagi API Wrapper

API Docs
Session Token
Not Set
API Keys
-
Requests Today
-
Assistant
No Cookie

Assistant usage

No billing snapshot yet.

Kagi Session Token

How to get your session token:

  1. Visit kagi.com/settings/user_details
  2. Copy the Session Link
  3. Extract the token value from the link (the part after token=)
No token configured

Default Settings

Kagi Assistant

The Kagi Assistant enables AI chat through Kagi's models. It requires a separate browser cookie in addition to the session token above.

How to get the _kagi_search_ cookie:

  1. Open kagi.com in your browser and make sure you are logged in
  2. Open DevTools — press F12 (Windows/Linux) or Cmd+Option+I (Mac)
  3. Go to the Application tab (Chrome/Edge) or Storage tab (Firefox)
  4. In the left sidebar, expand Cookies → click https://kagi.com
  5. Find the row named _kagi_search_
  6. Double-click the Value column to select it, then copy

This cookie is separate from the session token. The assistant exposes an OpenAI-compatible API at /v1/chat/completions.

Custom assistants

NameId to useModelSearch defaultLens

Assistant lenses

NameId

Lenses

Read-only view of the Kagi account's lenses. Use a lens name or id as the lens parameter on /api/v0/search. Only enabled lenses can be searched; manage them at kagi.com/settings/lenses.

Name ID Enabled Position Description
Click Refresh to load lenses from Kagi.

API Keys

External clients use these keys to authenticate with this wrapper.

Name Key Actions
Loading...

Search API

curl -H "Authorization: Bot YOUR_API_KEY" \
  "/api/v0/search?q=hello+world&limit=5"

Lenses (list available, then search with one)

curl -H "Authorization: Bot YOUR_API_KEY" \
  "/api/v0/lenses"

curl -H "Authorization: Bot YOUR_API_KEY" \
  "/api/v0/search?q=hello+world&lens=Reddit"

Chat Completions (OpenAI-Compatible)

curl -X POST "/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-4-6-sonnet","messages":[{"role":"user","content":"Hello!"}],"stream":true}'

Server Logs

Disconnected