You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,12 @@ Before `1.0.0`, breaking changes may still ship in minor releases.
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
12
+
- The configuration file now lives at a fixed XDG location instead of a working-directory-relative `./.kagi.toml`. It is resolved in this order: `$KAGI_CONFIG` (an explicit full file path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`. The file is still created with `0600` permissions, and the `KAGI_API_KEY`/`KAGI_API_TOKEN`/`KAGI_SESSION_TOKEN` environment variables continue to take precedence over it.
13
+
14
+
**Breaking:** credentials previously saved in a working-directory-relative `./.kagi.toml` are no longer read. Run `kagi auth set` (or `kagi auth`) once to re-save them at the new location, or point `KAGI_CONFIG` at your existing file.
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@
18
18
19
19
`kagi` is a terminal CLI for Kagi that gives you command-line access to search, quick answers, ask-page, assistant, translate, summarization, public feeds through `news` and `smallweb`, paid API commands like `fastgpt` and `enrich`, and account-level settings like lenses, custom assistants, custom bangs, and redirect rules. it is built for people who want one command surface for interactive use, shell workflows, and structured JSON output.
20
20
21
-
the main setup path is `kagi auth`. on a real terminal it opens a guided setup flow where you choose `Session Link`, `API Key`, or `Legacy API Token`, get the official instructions inline, paste the credential, save it to `./.kagi.toml`, and validate it immediately. if you also use Kagi's paid API, the same wizard can add that too.
21
+
the main setup path is `kagi auth`. on a real terminal it opens a guided setup flow where you choose `Session Link`, `API Key`, or `Legacy API Token`, get the official instructions inline, paste the credential, save it to `~/.config/kagi-cli/config.toml`, and validate it immediately. if you also use Kagi's paid API, the same wizard can add that too.
Environment variables override `./.kagi.toml`. When a session token and API key are both present, base `kagi search` defaults to the session token; set `[auth] preferred_auth = "api"` in config to prefer the API key.
80
+
Environment variables override `~/.config/kagi-cli/config.toml`. When a session token and API key are both present, base `kagi search` defaults to the session token; set `[auth] preferred_auth = "api"` in config to prefer the API key.
Copy file name to clipboardExpand all lines: docs/commands/auth.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: "Reference for the kagi auth wizard and non-interactive credential
5
5
6
6
# `kagi auth`
7
7
8
-
`kagi auth` is the main onboarding path for this CLI. On a real terminal, it launches an interactive setup wizard that lets you choose `Session Link`, `API Key`, or `Legacy API Token`, shows the official Kagi settings page for that credential, accepts a paste, saves into `./.kagi.toml`, and validates the selected credential immediately.
8
+
`kagi auth` is the main onboarding path for this CLI. On a real terminal, it launches an interactive setup wizard that lets you choose `Session Link`, `API Key`, or `Legacy API Token`, shows the official Kagi settings page for that credential, accepts a paste, saves into `~/.config/kagi-cli/config.toml`, and validates the selected credential immediately.
9
9
10
10

11
11
@@ -34,7 +34,7 @@ The wizard flow is:
34
34
4. accepts the pasted value
35
35
5. asks before overwriting an existing config value of the same type
36
36
6. validates the selected credential
37
-
7. saves to `./.kagi.toml`
37
+
7. saves to `~/.config/kagi-cli/config.toml`
38
38
8. warns if an environment variable will still override what you saved
39
39
40
40
### Session Link Path
@@ -109,7 +109,7 @@ preferred auth for base search: session
Environment variables override the config file. Use `--profile <NAME>` to select a named profile from `.kagi.toml`:
171
+
The config file is resolved from `$KAGI_CONFIG` (an explicit full path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`. Environment variables override the config file. Use `--profile <NAME>` to select a named profile from the config file (`~/.config/kagi-cli/config.toml`):
Copy file name to clipboardExpand all lines: docs/guides/authentication.mdx
+23-15Lines changed: 23 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ On a real terminal, the default setup path is:
15
15
kagi auth
16
16
```
17
17
18
-
The wizard lets you choose `Session Link`, `API Key`, or `Legacy API Token`, points you to the correct Kagi settings page, accepts a paste, saves into `./.kagi.toml`, and validates the selected credential immediately.
18
+
The wizard lets you choose `Session Link`, `API Key`, or `Legacy API Token`, points you to the correct Kagi settings page, accepts a paste, saves into `~/.config/kagi-cli/config.toml`, and validates the selected credential immediately.
19
19
20
20
Use `kagi auth set ...` only when you want a non-interactive or scripted flow.
21
21
@@ -219,10 +219,14 @@ env:
219
219
220
220
### Method 2: Configuration File
221
221
222
-
The `.kagi.toml` file provides persistent configuration:
222
+
The config file provides persistent configuration:
223
223
224
224
**Location:**
225
-
- `./.kagi.toml`in the current working directory
225
+
- `~/.config/kagi-cli/config.toml`
226
+
227
+
The config file is resolved from `$KAGI_CONFIG` (an explicit full path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`.
228
+
229
+
> **Migration note:** A pre-existing `./.kagi.toml` in your working directory is no longer read. Re-run `kagi auth set` (or `kagi auth`) once to re-save your credentials at the new location, or set `KAGI_CONFIG` to the old file path.
226
230
227
231
**File format:**
228
232
@@ -260,14 +264,15 @@ kagi auth set --session-token 'https://kagi.com/search?token=SESSION_TOKEN' --ap
The config file is resolved from `$KAGI_CONFIG` (an explicit full path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`.
This means you can override file configuration with environment variables for specific workflows or CI/CD.
343
+
The config file is resolved from `$KAGI_CONFIG` (an explicit full path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`. This means you can override file configuration with environment variables for specific workflows or CI/CD.
The config file is resolved from `$KAGI_CONFIG` (an explicit full path), then `$XDG_CONFIG_HOME/kagi-cli/config.toml`, then `~/.config/kagi-cli/config.toml`. A pre-existing `./.kagi.toml` is no longer read; re-run `kagi auth set` (or `kagi auth`) to re-save credentials at the new location, or set `KAGI_CONFIG` to the old file path.
0 commit comments