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

# Create models

> Turn stored weights into a running model, attach LoRA adapters, and choose serving settings.

A model is a set of files from storage, running in a cluster, ready to answer prompts. To create one you need:

* the model files in a [storage entry](https://docs.rivvr.ai/guides/storage.md),
* a cluster with the status `ACTIVE`,
* a spending limit per hour.

As soon as you create a model, Rivvr load-tests it, chooses suitable GPU machines and settings, and starts it. You don't need to run anything else.

## Create a model from storage

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr model create hello --storage MODEL_ENTRY_ID --cluster development --max-cost-per-hour 3 --wait
```

* `hello` is the model's name.
* `--storage` is the ID of the storage entry with the model files.
* `--cluster` is where the model runs.
* `--max-cost-per-hour` is the most it may spend per hour, in USD.
* `--wait` makes the command wait until the model is running (`DEPLOY_READY`). Without it, the command ends as soon as Rivvr accepts the request, and the work continues in the background.

You can leave out `--cluster` if you picked one earlier with `rivvr cluster use`. If you didn't, and the project has exactly one `ACTIVE` cluster, Rivvr uses it. If there are several, `rivvr` asks you to choose. Scripts can't answer that question, so always pass `--cluster` in scripts.

Model names are 3 to 128 characters long. Use lowercase letters, digits, and hyphens (`-`), and start and end with a letter or digit.

## Copy and create in one command

If the files are on Hugging Face or S3, `deploy` copies them into storage and creates the model:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr deploy hf://HuggingFaceTB/SmolLM2-135M-Instruct --name hello --max-cost-per-hour 3 --wait
```

`--name` is used for both the model and the new storage entry. `deploy` always waits for the copy to finish. With `--wait`, it also waits for the model to start. Both waits together are limited by one `--timeout`, 30 minutes by default.

For files on your own computer there's no single command. [Upload them](https://docs.rivvr.ai/guides/storage.md#upload-from-your-computer) first, then run `model create`.

## Add LoRA adapters

A LoRA adapter is a small add-on that changes how a model answers, for example to fit one kind of task. One model can use several adapters.

Copy or upload each adapter into storage with `--type lora`. Then add them when you create the model, each with a name:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr model create support --storage MODEL_ENTRY_ID \
  --lora billing=BILLING_ADAPTER_ID \
  --lora returns=RETURNS_ADAPTER_ID \
  --max-cost-per-hour 3 --wait
```

In `billing=BILLING_ADAPTER_ID`, `billing` is the name you choose and the part after `=` is the adapter's storage entry ID. Adapter names can use lowercase letters, digits, `.`, `_`, and `-`. They must start and end with a letter or digit, and each name can be used only once per model. The model and all its adapters must be in the same project.

## Serving settings

Serving settings control how the model runs. `model create` and `deploy` accept the same ones. Only `--max-cost-per-hour` is required. The rest have defaults, so you can ignore them at first. The [glossary](https://docs.rivvr.ai/get-started/glossary.md#ai-and-model-terms) explains the terms.

| Option | Default | What it means |
| - | - | - |
| `--max-cost-per-hour` | required | Most the model may spend per hour, in USD. At least `0.01`, or `0` if scale to zero is on |
| `--max-model-length` | `300` | Context length: the most tokens one request can use, prompt and answer together |
| `--model-dtype` | `AUTO` | Number format of the weights. Other choices: `FLOAT16`, `BFLOAT16`, `FLOAT`, `FLOAT32` |
| `--kv-cache-dtype` | `AUTO` | Number format of the KV cache. Other choice: `FP8` |
| `--quantization` | `NONE` | How the weights are compressed. Choices: `AWQ`, `GPTQ`, `GGUF`, `INT4`, `INT8`, `FP8` |
| `--slo-mode` | `BALANCED` | What to favor. `ECONOMY` saves money, `SPEED` makes it faster |
| `--average-prefill-tokens` | `200` | How long you expect a typical prompt to be, in tokens |
| `--average-decode-tokens` | `100` | How long you expect a typical answer to be, in tokens |
| `--ttft-p50-ms`, `--ttft-p90-ms` | not set | Target wait for the first word of the answer, in milliseconds |
| `--tps-p50`, `--tps-p90` | not set | Target writing speed, in tokens per second |
| `--min-qps`, `--max-qps` | not set | Expected number of requests per second |
| `--scale-to-zero` | off | Let the model use no GPUs while nobody sends it requests |
| `--automatic-optimization` | on | Let Rivvr tune how the model runs. Add `=false` to turn it off |

The default context length, 300 tokens, is only enough for short tests. For real use, raise it and tell Rivvr how long your prompts and answers usually are:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr model create long-context --storage MODEL_ENTRY_ID \
  --max-model-length 2048 \
  --average-prefill-tokens 1000 --average-decode-tokens 200 \
  --max-cost-per-hour 3 --wait
```

Rivvr refuses settings that contradict each other:

* Average prompt tokens plus average answer tokens can't be more than `--max-model-length`.
* The p90 wait for the first token must be at least the p50 wait.
* The p90 writing speed can't be higher than the p50 speed.
* `--max-qps` must be at least `--min-qps`.
* Token counts, request rates, and time targets must be above zero.

`rivvr` doesn't check whether your model files support the number format or compression you choose. Check that in the model's documentation.

## What the cost limit covers

`--max-cost-per-hour` limits what this one model spends on serving. It doesn't limit the cluster. Setting it to `0` with scale to zero also doesn't mean your infrastructure bill will be zero. [Costs and billing](https://docs.rivvr.ai/guides/costs-and-billing.md) explains how costs are counted.

Later, with [`model update`](https://docs.rivvr.ai/guides/manage-models#change-a-model), you can change the cost limit, SLO mode, expected prompt and answer lengths, and targets. You can't change the model files, adapters, number formats, compression, or context length after the model is created. For those, create a new model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.