# Deploy a model

Create an Endpoint from a model repository. The only required input is the
model; everything else defaults to **Auto**, which picks a validated runtime and
the smallest qualified accelerator that fits the weights.

In the Console, choose **Deploy a model** on Overview or **New endpoint** under
**Endpoints**. From the
CLI or SDK:

```sh
nestor inference endpoints create --model Qwen/Qwen2.5-0.5B-Instruct --name chat --wait
```

```python
from nestor import Nestor

client = Nestor()
endpoint = client.inference.endpoints.create(
    model="Qwen/Qwen2.5-0.5B-Instruct", name="chat", wait=True
)
print(endpoint.id, endpoint.state)
```

`--wait` returns when the Endpoint is `READY` or has failed. Without it, the
command returns as soon as the deployment is accepted.

## Which models work

A model Endpoint serves public Hugging Face repositories that:

- use an architecture the managed runtime supports;
- have unquantized, AWQ, GPTQ, FP8 or compressed-tensors weights;
- declare a chat template (model Endpoints serve chat completions only);
- fit the qualified hardware at the requested GPU count.

Nestor checks this before anything is created. A model that cannot be served is
refused with 400 `INVALID_ARGUMENT` and a reason that says what to change:

| Reason | What to do |
| --- | --- |
| `MODEL_ARCHITECTURE_UNSUPPORTED` | Deploy the model in a [container](/inference/containers). |
| `MODEL_WEIGHT_FORMAT_UNSUPPORTED` | Use one of the supported weight formats. |
| `MODEL_CHAT_TEMPLATE_MISSING` | Use a chat or instruct variant of the model. |
| `MODEL_METADATA_INCOMPLETE` | The repository is missing weights, context length or architecture facts; use a complete repository. |
| `HARDWARE_INSUFFICIENT` | The weights do not fit the qualified hardware at that GPU count; choose a smaller model or more GPUs. |
| `MODEL_ACCESS_UNSUPPORTED` | Private and gated repositories are not served on managed capacity. Deploy them in a [container](/inference/containers). |

## Options

| Option | CLI | SDK | Default |
| --- | --- | --- | --- |
| Model | `--model org/repo` | `model=` | required |
| Model revision | `--revision v3` | `revision=` | `main` |
| Accelerator family | `--accelerator H100_SXM` | `accelerator=` | Auto |
| GPUs per replica | `--gpus 2` | `gpu_count=` | Auto |
| Region | `--region REGION` | `region=` | Auto |
| Replicas | `--replicas 2` | `replicas=` | 1 |
| Name and labels | `--name`, `--label k=v` | `name=`, `labels=` | |

Nestor resolves a branch or tag to the commit it names at deployment and records
that commit. A deployed revision never follows a moving branch; redeploying
`main` later creates a new revision with the new commit.

Each replica holds its own GPUs. A request that names hardware or a region with
no free qualified capacity is refused with 503 `UNAVAILABLE` with `details.reason` `CAPACITY_UNAVAILABLE`.

## Update

```sh
nestor inference endpoints update endp_… --name "chat (prod)"     # metadata only
nestor inference endpoints update endp_… --replicas 2 --wait       # new revision
```

Changing the name or labels applies at once. Changing the model, runtime,
hardware, region or replica count creates a new **revision**: Nestor deploys it
beside the serving one, switches traffic when it is healthy, then retires the
old one. The URL does not change. If the new revision fails, the old one keeps
serving. Because both run at once during the switch, an update needs free
capacity and allowance for the new revision.

To roll back, update the Endpoint to the previous values.
`nestor inference endpoints revisions endp_…` lists every revision, including
what you asked for and what Nestor resolved it to.

## Delete

```sh
nestor inference endpoints delete endp_… --wait
```

Deletion stops new requests immediately, stops the runtime and releases the
GPUs. Nestor then verifies the hardware is clean before any other workload uses
it. While deletion is in progress the Endpoint still counts against your
allowance; wait for it to finish before starting a replacement. Revisions,
events and audit history stay readable after deletion.

## Usage

A dedicated Endpoint is metered by the hours its replicas are serving. Input and
output tokens are recorded per request for usage reporting. **Usage** in the
Console shows both.
