# Models and inference

> Connect a provider, serve models on your own hardware, and let chat, agents and jobs pick from one catalog.

## How an isotope gets models

Two sources: a hosted provider reached over HTTPS with an API key, and models the isotope serves itself on its CPU, its GPU or a rented GPU pool. Both appear in one catalog of model names that chat, the agent and jobs share. **Auto**, the default, routes each call to a model here or on a verified peer in the mesh: a responsive Grok route first, then each isotope’s preferred model, then every other route. Within each tier, the route expected to finish the call soonest goes first, and a route that failed recently goes last. A call fails over when its route breaks. An Auto turn with no reachable model waits for one, for up to an hour, rather than failing; a turn that names a model nothing holds is refused.

## Connect a provider

An isotope starts with no model, and `drkm start` asks nothing about one. While nothing on the isotope or its mesh can answer, the chat composer's model selector reads **Load a model**. It opens a dialog that offers an administrator the library model sized for this hardware: **Get** pulls it, the dialog shows the download, and the selector shows its progress until the model can answer. A link opens Settings → Models for another model or a provider. Other users are told an administrator can add one. In the terminal, `drkm models setup` offers three choices: connect an inference provider with an API key, run a local model sized for this device’s GPU, or set up later. The local choice appears only on a machine with a GPU drkm can probe. A Mac also needs a vLLM runtime someone installed, because the runtime is installed automatically only on Linux with an NVIDIA GPU. The provider path offers OpenRouter, or any other OpenAI-compatible endpoint by its HTTPS base URL. It then takes the key, typed hidden, and a model ID, and sends a short test completion before saving the key encrypted.

Administrators can also do this in the console under **Settings → Assistant**: **Default model** picks the model for new chats, **Context windows** shows each model’s window and where the figure came from, and **Model providers** shows Azure AI Foundry, OpenAI, Anthropic, xAI and OpenRouter as logos. Clicking one opens a dialog that links to the provider’s sign-up and key pages and connects it with the key; Azure AI Foundry also takes your resource’s endpoint, such as `https://<resource>.services.ai.azure.com/openai/v1`. **More** there, or **Settings → Models → Providers → Add provider**, also offers Mistral, Google Gemini, Groq, Together AI and DeepSeek, or **Custom** for any OpenAI-compatible server. Once connected, the dialog lists that provider’s own models with their context windows, and a switch puts each one in chat; an Azure deployment is added by its name.

```bash Terminal
drkm start
drkm models setup

drkm console models        # the chat catalog: models, served, holders, default
```

<Note>
  drkm models setup needs a running local isotope and an interactive terminal. The key is stored encrypted and never shown again.
</Note>

## Run a model on your hardware

The wizard’s local choice supports Linux NVIDIA GPUs: it sizes a pinned open model to the GPU it finds and launches the packaged serving runtime, which needs NVIDIA drivers, Docker and the NVIDIA Container Toolkit, 80% of one GPU free and tens of gigabytes of disk for the first build. Outside the wizard, a Mac serves a language model through its native engine with `drkm engine install`, and a CPU-only Linux host serves a quantized GGUF model with `drkm serve <name> --engine llama-cpp` and an explicit engine profile.

The model library names models as Ollama does. `drkm pull qwen3:8b` downloads that size, or `drkm pull qwen3` the family’s default, in a file sized to this isotope, and starts it. `drkm run` starts a model the isotope holds, or pulls one it lacks, then opens a `>>>` prompt; that prompt needs a Mac’s native engine, and elsewhere you chat with the model in the console. `drkm ls`, `ps`, `show`, `stop` and `rm` list, inspect, unload and remove models. One local language model runs at a time, so a pull replaces the one running.

The lower-level host commands stage any model into the isotope’s registry and serve it: `drkm pull` also stages a registry snapshot by name or imports one from a hub with `hf://`, `drkm serve` starts an engine on it, and `drkm models list` shows what the registry holds.

```bash Terminal
drkm pull qwen3:8b                     # or qwen3 for its default size
drkm run qwen3:8b                      # a >>> prompt; /bye leaves
drkm ls                                # models this isotope holds
drkm ps                                # the model it runs
drkm stop qwen3:8b                     # drkm stop alone still stops the isotope
drkm rm qwen3:8b

drkm models list
drkm pull hf://<org>/<repo> --name my-model --revision <commit>
drkm serve my-model --engine vllm      # or llama-cpp, mlx, detector

# Mac: serve a language model through the native engine, persistently
drkm engine install my-model
drkm engine remove
```

## The Darkmatter catalog

In **Settings → Models**, **Set up a model** picks a language model that fits this isotope when none runs. The **Library** lists language model families and their sizes, as Ollama’s library lists them, each size marked for whether it fits this isotope. Clicking a size that fits pulls it and runs it. **Pull a model** searches Hugging Face, or takes a pasted `owner/model`: any public repository pulls, without an account. Gated and private repositories do not pull; drkm serves its own releases from its model depot. **Downloaded models** lists what is stored or running here: the vision detectors, **Overwatch** (planes, ships, vehicles and infrastructure in satellite imagery) and **Silhouette** (people in drone footage), and language models. Each row shows where it runs and its state, and offers **Deploy** or **Load**, **Stop** and **Remove**. Inkling 2 Mini on a DGX Spark also offers **Context window**: the node serves 131,072 tokens until an administrator chooses 262,144 or 524,288 there. The choice reloads the model, stays the node’s through restarts and updates, and costs 16 KiB of memory for each token of the window. Everyone can read the page; administrators act.

**Deploy** offers _This node · GPU_, _This node · CPU_ or, under Advanced, a _Modal pool_ of rented GPUs with a type, a count and how many to keep warm; the first pooled model adopts the pool and removing the last releases it. On an isotope with no serving controller, such as a cloud one, Deploy shows the Modal pool and selects it. An installed isotope downloads catalog models from the model depot with its update grant; one that is not signed in to drkm shows a lock, because it cannot download models it lacks. Run `drkm update` on its host once to sign in.

```bash Terminal
drkm start --detector            # serve the Overwatch detector here
drkm start --no-detector         # stop serving it

# Rent a GPU pool for the detectors from the host
drkm pool adopt modal --model overwatch-r3 --gpus 4 --warm 0
drkm pool release
```

## Speech recognition and other pipeline models

Any Hugging Face model whose task the transformers engine serves runs on an isotope beside its language model and detectors, each in an engine of its own. Today that task is **automatic speech recognition**: Whisper and the other models Hugging Face lists under it. Under **Settings → Models → Pull a model**, a search result tagged *Automatic speech recognition* offers **Pull**. The isotope pins the repository's current commit, downloads its safetensors weights into its registry, starts a transformers engine on its GPU (or CPU) and lists it under **Downloaded models** with **Stop**, **Load** and **Remove**. A repository whose task the engine does not serve is refused with that task's name. The first one a node serves builds the engine's image, which takes some minutes.

The model answers OpenAI's transcription API: `/inference/v1/audio/transcriptions` with a drkm API key from outside the isotope, or `/v1/audio/transcriptions` for programs on it. Files up to 25 MB are accepted, and the answer comes back whole.

```python Transcribe with the OpenAI SDK
from openai import OpenAI

client = OpenAI(base_url="https://<isotope>/inference/v1", api_key="<drkm API key>")
with open("briefing.flac", "rb") as audio:
    print(client.audio.transcriptions.create(model="whisper-large-v3-turbo", file=audio).text)
```

```bash Terminal
curl https://<isotope>/inference/v1/audio/transcriptions \
  -H "Authorization: Bearer <drkm API key>" \
  -F file=@briefing.flac -F model=whisper-large-v3-turbo
```

The same serve works by HTTP: `PUT /serving/models/<name>` with `{"source": {"repository": "openai/whisper-large-v3-turbo"}}` pulls and serves it under `<name>`, and once a node holds it, the name alone serves it again.

## Choose a model in chat

The composer’s **Model** menu lists _Auto_ first, then every catalog name; a model that peers also hold shows _here +N_ or the holder’s callsign. **Find model...** filters the list, and for an administrator a **Download** section offers library sizes that fit this isotope: picking one pulls it, shows its progress and selects it once it runs. Below it, **Thinking** runs from **Off** through **Light** and **Balanced** to **Deep**, or **Auto**, which keeps the model’s default. A new chat starts on the isotope’s default; reopening a conversation keeps its model. Each reply says which model answered.

```bash Terminal
drkm console chat --model auto --effort medium -p "Summarize today's jobs"
```

## Models for jobs

A worker declares the models it needs by alias in `package()`: a catalog name pins that model, a requirement such as `{"kind": "agent", "intelligence": "medium"}` states a floor that placement resolves, and `{"kind": "completion", "model": "vision"}` selects a configured completion lane. Inside the attempt, `context.models["alias"]` is a `drkm.Model` with `predict()`, `predict_batch()` and `analyze_image()`. A `predict` job needs no worker at all: it runs a served detector over each record’s one image, and the platform keeps every GPU the isotope has busy, pooled ones included.

```python Detections without a worker
import drkm

drkm.connect("https://isotope.example")
records = [{"id": "harbor-01", "files": ["tiles/harbor-01.png"]}]

job = (drkm.parallelize(records)
       .predict("overwatch-r3", conf=0.5)
       .submit(name="Vessels in harbor imagery"))
job.wait()
print(job.rows())
```

<Note>
  The model name must be a detector an eligible isotope serves or can load: overwatch-r3, silhouette-a2 or silhouette-a13. Settings → Models shows what this isotope holds, and drkm console peer-models \<callsign> shows what a member serves now; drkm console models lists the chat catalog only. A detector loaded for a job is unloaded after 15 idle minutes.
</Note>

## Serve across the mesh

An administrator can ask another isotope to serve a catalog model by name, one of the vision detectors, an entry of that member’s pinned language list or a pipeline model the member already holds, never an arbitrary download. The member’s own rules decide: a detector must fit its free GPU memory, a language model starts only on an idle engine, nothing replaces what already serves, and another isotope stops only what it started.

```bash Terminal
drkm console peer-models <callsign>
drkm console request-model <callsign> silhouette-a2
drkm console stop-model <callsign> silhouette-a2
```
