# Configuration

> Settings, endpoints, API keys, and named providers.

Open Max reads user settings from `~/.openmax/settings.json` and named provider definitions from `~/.openmax/providers.json`. Use `openmax --login` to add a connection and `/model` to select a provider and model for your session.

## Connect a compatible endpoint

For an OpenAI-compatible model server, pass the API root, the server's model ID, and the context window it actually provides. Replace the model ID and context window in this example with your server's values.

```sh
openmax --base-url http://127.0.0.1:11434/v1 \
  --model MODEL_ID --context-tokens 32768
```

Open Max appends `chat/completions` to the API root for this route. Configure the model server to return structured API tool calls. Open Max displays tool markup embedded in reply text as ordinary text.

Add `--api-key '$MODEL_API_KEY'` if the server needs a key. Export the variable before launching. The single quotes keep the shell from substituting its value, so Open Max can store the variable name and read the credential at request time.

On a first run, Open Max can save unset endpoint settings. Existing settings supplied as flags usually apply only to that run. The [command-line settings reference](https://github.com/Max17190/open-max/blob/main/docs/configuration.md#settings-from-the-command-line) explains how endpoint selection affects persistence.

## Use named providers

Add named endpoints to `~/.openmax/providers.json` when you use more than one server. Select one in `/model`, or pass `--provider NAME --model MODEL_ID` when launching Open Max. A named provider supplies its own endpoint and credentials. Use `/status` to inspect the active configuration.

See the [provider reference](https://github.com/Max17190/open-max/blob/main/docs/configuration.md#multiple-providers) for the JSON format, supported API protocols, headers, and compatibility settings. See [provider connections](https://github.com/Max17190/open-max/blob/main/docs/configuration.md#connecting-and-disconnecting-providers) for sign-in and credential storage.
