> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuratie

> Configureer de CometAPI CLI: locatie van het configuratiebestand, beschikbare instellingen, beheer van inloggegevens, omgevingsvariabelen en beveiligingspraktijken.

De CometAPI CLI leest instellingen uit een TOML-configuratiebestand, omgevingsvariabelen en command-line flags. Wanneer dezelfde instelling uit meerdere bronnen beschikbaar is, is de prioriteitsvolgorde:

**CLI flags > configuratiebestand > omgevingsvariabelen > standaardwaarden**

## Configuratiebestand

Locatie: `~/.config/cometapi/config.toml`

Voer de setupwizard uit om het configuratiebestand interactief aan te maken:

```bash theme={null}
cometapi init
```

Of beheer afzonderlijke instellingen met de subopdracht `config`:

```bash theme={null}
# View current configuration
cometapi config show

# Set a value
cometapi config set api_key "$COMETAPI_KEY"

# Remove a value
cometapi config unset api_key

# Show the config file path
cometapi config path
```

## Beschikbare instellingen

| Config key      | Environment variable     | Beschrijving                                                            |
| --------------- | ------------------------ | ----------------------------------------------------------------------- |
| `api_key`       | `COMETAPI_KEY`           | API key (vereist voor alle opdrachten)                                  |
| `access_token`  | `COMETAPI_ACCESS_TOKEN`  | Access token voor opdrachten op accountniveau                           |
| `base_url`      | `COMETAPI_BASE_URL`      | API-basis-URL (standaard: `https://api.cometapi.com/v1`)                |
| `default_model` | `COMETAPI_DEFAULT_MODEL` | Standaardmodel voor `chat` en `run` (fallback: `gpt-5.4`)               |
| `output_format` | —                        | Standaard uitvoerindeling: `table`, `json`, `yaml`, `csv` of `markdown` |

## Inloggegevens

De CLI gebruikt twee soorten inloggegevens:

### API key

Vereist voor alle opdrachten. De API key authenticeert verzoeken naar de CometAPI-modelendpoints.

Maak een API key aan via [CometAPI Console → API Keys](https://www.cometapi.com/console/token).

Stel deze op een van de volgende manieren in:

<CodeGroup>
  ```bash Environment variable theme={null}
  read -rsp "CometAPI API key: " COMETAPI_KEY
  printf '\n'
  export COMETAPI_KEY
  ```

  ```bash Config file theme={null}
  cometapi config set api_key "$COMETAPI_KEY"
  ```

  ```bash Setup wizard theme={null}
  cometapi init
  ```
</CodeGroup>

### Access token

Optioneel. De access token is vereist voor opdrachten op accountniveau: `account`, `stats`, `tokens`, `logs` en `tasks`.

Genereer een access token via [CometAPI Console → Personal Settings](https://www.cometapi.com/console/personal).

Stel deze op een van de volgende manieren in:

<CodeGroup>
  ```bash Environment variable theme={null}
  export COMETAPI_ACCESS_TOKEN="your-access-token"
  ```

  ```bash Config file theme={null}
  cometapi config set access_token your-access-token
  ```

  ```bash Setup wizard theme={null}
  cometapi init
  ```
</CodeGroup>

## Beveiliging

De CLI past de volgende beveiligingspraktijken toe:

* API keys en access tokens worden nooit gelogd of volledig weergegeven. Alleen de laatste 4 tekens worden getoond in diagnostische uitvoer.
* Het configuratiebestand wordt aangemaakt met restrictieve rechten (`0600`) — alleen leesbaar voor de eigenaar van het bestand.
* Inloggegevens mogen nooit in versiebeheer worden opgenomen. Voeg het pad van het configuratiebestand toe aan je `.gitignore` indien van toepassing.

<Warning>
  Je bent verantwoordelijk voor al het gebruik en de kosten die met je API keys worden gemaakt. Bewaar je sleutels veilig en roteer ze als je ongeautoriseerde toegang vermoedt.
</Warning>

## Probleemoplossing

| Error                         | Solution                                                                                                      |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `API key not configured`      | Voer `cometapi init` uit of stel de omgevingsvariabele `COMETAPI_KEY` in                                      |
| `Connection failed`           | Voer `cometapi doctor` uit om connectiviteit te diagnosticeren                                                |
| `Access token not configured` | Alleen nodig voor `account`/`stats`/`tokens`/`logs`/`tasks`. Voer `cometapi init` uit om er een toe te voegen |
