# Continuous models

> Continuous models (projects in the SDK and API), only available to invited organizations: create one, call its production version or its preview, auto-promote, promote and roll back versions, feedback, price.

Part of the Endor docs. Index of every page: https://endor.thetokencompany.com/llms.txt. HTML version: https://endor.thetokencompany.com/docs/continuous-learning.

> **Continuous models are only available to invited organizations.** To ask for an invitation, email rasmus@thetokencompany.com. `GET /v1/whoami` returns `"continuous_learning": true` once yours has them. Until then, every `/v1/projects` call and every decision on a continuous model fails with `403 continuous_learning_not_enabled`, and the dashboard has no Continuous models page. Train and call models in [custom projects](https://endor.thetokencompany.com/docs/training) instead.

A continuous model learns by itself from the decisions you send it. That is all it needs: Endor has a frontier model answer a share of them and trains new versions from those answers. When you later learn the right answer to a decision, from a review or an outcome, you can also send it as [feedback](#optional-improve-it-with-feedback). That is optional, a way to push the model further. Each new version goes to production as soon as it is ready (auto-promote), or you turn auto-promote off and promote versions yourself. You do not upload data or train.

In the SDK and the API, continuous models are projects: `client.projects`, `/v1/projects`.

## Create a continuous model

A continuous model has one base model, chosen when you create it. You cannot change it later.

```python
import endor

client = endor.EndorClient()
project = client.projects.create("tickets", base_model="mapika/decider-2b", description="Route support tickets")
```

```bash
curl -X POST https://api.endor.thetokencompany.com/v1/projects \
  -H "Authorization: Bearer $ENDOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "tickets", "base_model": "mapika/decider-2b"}'
```

In the dashboard, click **New continuous model**. The base model list puts the one that fits its name and description first, marked **Recommended**. An organization can have 5 continuous models; email rasmus@thetokencompany.com for more.

## Production and preview

Each continuous model works like a deployment, with two versions you can call:

| `model` | Answers with |
|---|---|
| `tickets` | The **production** version. Call it from your app. |
| `tickets:preview` | The **preview**: the newest version, while it isn't in production. Use it to try a version before you promote it. |

Before the first version, `tickets` answers with the base model. When the newest version is in production, there is no preview: `tickets:preview` fails with `404 no_preview`. The response's `model` names the version that answered, for example `tickets:v4`, and that name can be called too while v4 is in production or the preview. It stops answering once another version replaces it, so to follow new versions, call `tickets`. Other versions can't be called: `tickets:v3` fails with `404 version_not_callable`. Promote a version to call it.

### Auto-promote

Auto-promote is on for a new continuous model: each new version goes to production as soon as it exists, so there is no preview. A first version goes to production only once it answers better than the base model; until then it is the preview. Turn auto-promote off to keep each new version at `tickets:preview` until you promote it.

```python
project.set_auto_promote(False)  # new versions go to preview only
project.set_auto_promote(True)   # the preview goes to production at once, and each new version after it
```

Over HTTP: `PATCH /v1/projects/tickets` with `{"auto_promote": false}`. In the dashboard, use the **Auto-promote** switch on its **Settings** tab.

### Promote a version

Promote any version to put it in production. Promoting a version older than the newest is a rollback: it turns auto-promote off, so the version you chose stays in production until you promote another one or turn auto-promote on again.

```python
for v in project.versions():  # newest first
    print(v.name, v.production, v.preview, v.accuracy)
project.promote("v3")  # "tickets" answers with v3 from now on
```

Over HTTP: `POST /v1/projects/tickets/versions/v3/promote`. In the dashboard, open a version's menu and click **Promote to production**.

## Follow it

Its **Models** tab in the dashboard shows the production version (and the preview, when there is one), the progress toward the next version, and each version with its accuracy. The progress counts the distinct decisions it can learn from, so sending the same decision again doesn't move it. Over the API: `GET /v1/projects/{project}/learning` (`project.learning()` in the SDK) and `GET /v1/projects/{project}/versions` (`project.versions()`).

```bash
curl https://api.endor.thetokencompany.com/v1/projects/tickets/learning -H "Authorization: Bearer $ENDOR_API_KEY"
```

## Keep decisions out of learning

Send `exclude_from_training: true` with a decision to keep it out of the continuous model's learning, for example when you run a benchmark against it. The decision is still answered, billed and logged.

```python
client = endor.EndorClient(exclude_from_training=True)  # every decision of this client
res = client.system_one(state, questions, model="tickets", exclude_from_training=True)  # or one decision
```

## Download a version

You can download any version's weights, a LoRA adapter for its base model: `project.download("v3", "./v3")`, or `GET /v1/projects/{project}/versions/{version}/download`. See [Run a model outside Endor](https://endor.thetokencompany.com/docs/training#run-a-model-outside-endor).

## Optional: improve it with feedback

A continuous model doesn't need feedback to learn. When you find out whether a decision was right, for example when someone reviews it or you learn the outcome, you can tell Endor, and the continuous model learns from it in its next versions, including answers a frontier model wouldn't know. See [Give feedback on decisions](https://endor.thetokencompany.com/docs/decisions#give-feedback-on-decisions).

```python
res = client.system_one(state, questions, model="tickets")
# later, once you know
client.corrections.create(res, {
    "department": {"correct": False, "answer": "technical"},  # wrong: the right answer
    "urgent": {"correct": True},                               # right
})
```

## Price

All decisions of a continuous model cost the continuous-learning price of its base model: 1.5 × the decision price, also before the first version. The price includes the learning. See [Base models](https://endor.thetokencompany.com/docs/base-models). In usage rows, `continuous_learning` is `true` for these decisions.

## Other pages

- [Overview](https://endor.thetokencompany.com/docs/index.md): What Endor does: you train decision models on your labeled data in custom projects with the SDK, Endor runs the GPUs, and you call them by name. Continuous models are for invited organizations.
- [Quickstart](https://endor.thetokencompany.com/docs/quickstart.md): Start here: install the SDK, measure base models on your data, train a model in a custom project, evaluate it, promote it and call it.
- [Core concepts](https://endor.thetokencompany.com/docs/concepts.md): Organizations, continuous models and their production and preview versions, names, base models, custom projects, datasets, runs, evaluations and futures.
- [Custom projects](https://endor.thetokencompany.com/docs/training.md): Custom projects (custom_models in the SDK and API): train a model with the SDK, save, promote to production, call, download; the training loop in detail.
- [Decisions](https://endor.thetokencompany.com/docs/decisions.md): Decisions with the SDK and over HTTP, model names, giving feedback on them, TypeSafe clients, cold starts, errors.
- [Base models](https://endor.thetokencompany.com/docs/base-models.md): The 18 base models: limits, rules, prices and cold starts.
- [Billing & limits](https://endor.thetokencompany.com/docs/billing.md): Prices, the prepaid balance, usage and limits.
- [Data format](https://endor.thetokencompany.com/docs/data-format.md): Decision rows, question types, hard and soft labels, datums and limits: the data for custom projects.
- [API reference](https://endor.thetokencompany.com/docs/api.md): Each /v1 endpoint: method, path, body fields, response fields and errors.
- [Python SDK](https://endor.thetokencompany.com/docs/sdk.md): The Python SDK (0.9.0): client, continuous models (client.projects) and versions, custom projects (client.custom_models), datasets, runs, evaluations, futures, data helpers, recipes, errors, CLI.
- [Updates](https://endor.thetokencompany.com/docs/updates.md): Changes to the API and SDK, newest first, and when old names and endpoints stop working.
- [Index](https://endor.thetokencompany.com/llms.txt): every page and the API schema.
