bots-garden/razorbillpublic Fork
⑂ v0.2.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
configure-the-server.md · 118 lines · 3.1 KBmarkdown
Blame HistoryOpen raw

How to configure the server

This guide writes a configuration file for rzb serve: short model names, generation defaults and locks, memory limits, and network access. It assumes you have started the server once (see the tutorial).

1. Write the file

Start from the commented example:

cp examples/server.yaml server.yaml

Or write a minimal one:

models:
  - id: qwen3
    source: mlx-community/Qwen3-4B-4bit
  - id: embed
    source: BAAI/bge-small-en-v1.5
    kind: embedding

Clients now send "model": "qwen3" instead of the Hugging Face id. Undeclared Hugging Face ids keep working.

2. Check it, then use it

rzb config validate server.yaml
rzb serve --config server.yaml

config validate lists every problem with its line number; fix them and run it again.

Set defaults clients may change

defaults:
  temperature: 0.3
  max_tokens: 2048

A request that sends temperature uses its own value; one that does not gets 0.3.

Lock settings clients may not change

locked:
  max_tokens: 4096        # a ceiling: requests asking for more get 4096
  show_reasoning: false   # never send the reasoning to clients

temperature, top_p, thinking and show_reasoning are imposed; max_tokens and thinking_budget are ceilings.

Settings for one model only

models:
  - id: qwen3-thinking
    source: mlx-community/Qwen3-4B-4bit
    defaults: { thinking: true, thinking_budget: 512 }
    locked: { max_tokens: 8192 }

The model's blocks apply after the top-level ones. Two entries may use the same source with different settings; they share one load.

Load a model at start-up

models:
  - id: embed
    source: BAAI/bge-small-en-v1.5
    kind: embedding
    preload: true

The server then answers the first request without the loading delay.

Keep several models in memory

limits:
  max_loaded_models: 2   # e.g. one chat model and one embedding model
  keep_alive: 30m        # unload a model idle for 30 minutes
  max_queue: 32          # requests waiting per model before a 429

Use a model from a local directory

models:
  - id: mine
    path: ~/models/my-mlx-model   # config.json, tokenizer files, *.safetensors

Open the server to your network

Set a key in the environment, then listen on every interface:

export RZB_API_KEY="$(openssl rand -hex 24)"
rzb serve --config server.yaml --host 0.0.0.0

Clients send Authorization: Bearer <key> (the api_key of OpenAI clients). To read the key from another variable, use --api-key-env MY_VAR or server.api_key_env: MY_VAR. The key never goes in the file.

Let a web page call the API

rzb serve --config server.yaml --cors-origin http://localhost:3000

Use * for any origin only with an API key: otherwise any page you open can use your models.

See also

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# How to configure the server

This guide writes a configuration file for `rzb serve`: short model names, generation defaults and locks, memory limits, and network access. It assumes you have started the server once (see the [tutorial](../tutorials/getting-started.md)).

## 1. Write the file

Start from the commented example:

```bash
cp examples/server.yaml server.yaml
```

Or write a minimal one:

```yaml
models:
  - id: qwen3
    source: mlx-community/Qwen3-4B-4bit
  - id: embed
    source: BAAI/bge-small-en-v1.5
    kind: embedding
```

Clients now send `"model": "qwen3"` instead of the Hugging Face id. Undeclared Hugging Face ids keep working.

## 2. Check it, then use it

```bash
rzb config validate server.yaml
rzb serve --config server.yaml
```

`config validate` lists every problem with its line number; fix them and run it again.

## Set defaults clients may change

```yaml
defaults:
  temperature: 0.3
  max_tokens: 2048
```

A request that sends `temperature` uses its own value; one that does not gets `0.3`.

## Lock settings clients may not change

```yaml
locked:
  max_tokens: 4096        # a ceiling: requests asking for more get 4096
  show_reasoning: false   # never send the reasoning to clients
```

`temperature`, `top_p`, `thinking` and `show_reasoning` are imposed; `max_tokens` and `thinking_budget` are ceilings.

## Settings for one model only

```yaml
models:
  - id: qwen3-thinking
    source: mlx-community/Qwen3-4B-4bit
    defaults: { thinking: true, thinking_budget: 512 }
    locked: { max_tokens: 8192 }
```

The model's blocks apply after the top-level ones. Two entries may use the same `source` with different settings; they share one load.

## Load a model at start-up

```yaml
models:
  - id: embed
    source: BAAI/bge-small-en-v1.5
    kind: embedding
    preload: true
```

The server then answers the first request without the loading delay.

## Keep several models in memory

```yaml
limits:
  max_loaded_models: 2   # e.g. one chat model and one embedding model
  keep_alive: 30m        # unload a model idle for 30 minutes
  max_queue: 32          # requests waiting per model before a 429
```

## Use a model from a local directory

```yaml
models:
  - id: mine
    path: ~/models/my-mlx-model   # config.json, tokenizer files, *.safetensors
```

## Open the server to your network

Set a key in the environment, then listen on every interface:

```bash
export RZB_API_KEY="$(openssl rand -hex 24)"
rzb serve --config server.yaml --host 0.0.0.0
```

Clients send `Authorization: Bearer <key>` (the `api_key` of OpenAI clients). To read the key from another variable, use `--api-key-env MY_VAR` or `server.api_key_env: MY_VAR`. The key never goes in the file.

## Let a web page call the API

```bash
rzb serve --config server.yaml --cors-origin http://localhost:3000
```

Use `*` for any origin only with an API key: otherwise any page you open can use your models.

## See also

- Every key, type and default: [configuration reference](../reference/configuration.md).
- How models are loaded, queued and unloaded: [model lifecycle](../explanation/model-lifecycle.md).