> ## Documentation Index
> Fetch the complete documentation index at: https://nirmauniversity-d6cdc5d7-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Understand NoteWise config storage, environment variables, defaults, and command overrides.

NoteWise reads settings from code defaults, `config.db`, environment variables, and command flags.

## State directory

By default, state lives under `~/.notewise`.

| File or folder                   | Purpose                                           |
| -------------------------------- | ------------------------------------------------- |
| `~/.notewise/config.db`          | User config written by `notewise setup`/`config`. |
| `~/.notewise/.notewise_cache.db` | SQLite cache and run history.                     |
| `~/.notewise/logs/`              | Session logs.                                     |
| `~/.notewise/oauth/`             | Default OAuth token storage.                      |

Set `NOTEWISE_HOME` to move this state root.

<Note>
  Older installs stored config in a `~/.notewise/config.env` text file. On the
  first run after upgrading, NoteWise imports any existing `config.env` into
  `config.db` and deletes the file — no manual migration needed.
</Note>

## Practical precedence

For a command run, command-line flags win. For `OUTPUT_DIR`, the value in `config.db` is used unless `--output` is passed. Other settings use environment variables, then `config.db`, then code defaults.

```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
notewise process "https://youtu.be/VIDEO_ID" --model gemini/gemini-2.5-flash --output ./notes
```

## Custom OpenAI-compatible endpoints

`notewise setup` lists built-in providers, each saved custom endpoint by name, and
**Add custom OpenAI-compatible endpoint**. Select a saved endpoint to use its
current configuration, or choose **Add** to enter a name, base URL, and API key.
For either path, setup requests the endpoint's current `/v1/models` list, requires
you to select a discovered model, and sends a tiny completion request to verify
that selection. The verification can incur a small provider charge.

Adding an endpoint appends it to the registry. Adding a name that normalizes to an
existing name replaces only that endpoint after discovery and verification succeed;
other saved endpoints remain unchanged. Names are unique after normalization and
cannot use LiteLLM provider prefixes. Base URLs must be absolute HTTPS URLs, except
explicit loopback endpoints may use HTTP. Setup accepts a URL with or without `/v1`
and stores it with the `/v1` suffix.

The registry is stored as one row per endpoint (`name`, `base_url`, `api_key`) in a
dedicated table in `~/.notewise/config.db`, managed with `notewise inference
list|add|update|delete`. You can also override the whole registry for one process
with the `CUSTOM_LLM_ENDPOINTS` environment variable, a compact JSON array with the
same fields — this safe two-profile example uses placeholder credentials:

```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
export CUSTOM_LLM_ENDPOINTS='[{"name":"team-gateway","base_url":"https://gateway.example.com/v1","api_key":"example-team-token"},{"name":"lab-server","base_url":"https://lab.example.net/v1","api_key":"example-lab-token"}]'
export DEFAULT_MODEL=team-gateway/your-model-id
```

Custom models are always named `<name>/<model-id>`. When that name exactly matches
a saved profile prefix, NoteWise uses that profile's endpoint configuration and
sends the compatible request as `openai/<model-id>`. `CUSTOM_LLM_ENDPOINTS` is a
secret-bearing value: `notewise config` masks the entire value, and NoteWise never
copies its credentials into ambient environment variables.

## Common config keys

| Key                           | Default                   | Meaning                                                                               |
| ----------------------------- | ------------------------- | ------------------------------------------------------------------------------------- |
| `DEFAULT_MODEL`               | `gemini/gemini-2.5-flash` | LiteLLM model string.                                                                 |
| `CUSTOM_LLM_ENDPOINTS`        | unset                     | Secret-bearing compact JSON registry of named custom endpoints.                       |
| `OUTPUT_DIR`                  | `./output`                | Default output directory.                                                             |
| `MAX_CONCURRENT_VIDEOS`       | `5`                       | Batch/playlist video workers.                                                         |
| `MAX_CONCURRENT_CHAPTERS`     | `3`                       | Per-video chapter generation workers.                                                 |
| `CHUNK_SIZE`                  | `12000`                   | Transcript chunk size, in tokens.                                                     |
| `CHUNK_OVERLAP`               | `1500`                    | Overlap between chunks, in tokens. Must be smaller than `CHUNK_SIZE`.                 |
| `YOUTUBE_REQUESTS_PER_MINUTE` | `10`                      | YouTube request limit.                                                                |
| `TEMPERATURE`                 | `0.7`                     | LLM temperature.                                                                      |
| `MAX_TOKENS`                  | `20000`                   | LLM max output tokens.                                                                |
| `DEFAULT_LANGUAGES`           | `["en"]`                  | Preferred transcript languages. JSON array (`config set` also takes comma-separated). |
| `YOUTUBE_COOKIE_FILE`         | unset                     | Default Netscape cookies file path.                                                   |
| `ALLOW_UNLISTED_MODELS`       | `false`                   | Permit out-of-catalog models.                                                         |

Provider API keys and provider auth keys are also accepted in `config.db` (via `notewise config set KEY VALUE`) when they are listed in source constants. Omit `VALUE` for a sensitive key to be prompted for it with hidden input instead of typing it as a plain CLI argument.

## Commands

```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
notewise setup
notewise setup --show
notewise setup --force
notewise config
notewise config keys
notewise config get DEFAULT_MODEL
notewise config set DEFAULT_MODEL gemini/gemini-2.5-flash
notewise config unset MAX_TOKENS
notewise config edit
notewise config-path
notewise edit-config
```

`notewise config` (no arguments) masks secrets before printing all settings.
`notewise config keys` lists every key `get`/`set`/`unset` accept, since the
full set (provider API keys, provider auth keys, and core settings) isn't
obvious up front. `notewise config get/set/unset` read or write one key at a
time; `set` validates the new value immediately and reports an error without
leaving the process in a broken state if it's invalid (e.g. `TEMPERATURE` out
of range). `notewise config edit` is an interactive, category-grouped
browser/editor over the same keys (Model & Generation, Concurrency &
Performance, Output & Transcripts, Custom Endpoints, OAuth Token
Directories, Provider API Keys, Provider Auth & Cloud Credentials) — pick a
category, pick a key, then set or unset it, without needing to already know
its exact name; secrets stay masked and prompt with hidden input, same as
`set`. The **Custom Endpoints** category is a table-based add/update/delete
manager over the same saved endpoint rows as `notewise inference
list|add|update|delete`, not a raw-JSON editor for `CUSTOM_LLM_ENDPOINTS`.
`edit-config`
opens the current settings as an editable env-style file in your `$EDITOR`, then
re-saves whatever you leave in it — including removing lines you delete.
