# AI models and costs

Use an OpenRouter key or your own OpenAI-compatible model, and see the cost before ZeroWidth reads anything.

ZeroWidth uses an AI model to read decisions, answer questions and dream. Each of those calls costs money with a hosted model.

## OpenRouter

The default. ZeroWidth reads your key from `OPENROUTER_API_KEY`, or from `~/.config/zerowidth/env`. To use another environment variable, name the variable in zerowidth.json as `model.keyEnv`. You pay OpenRouter directly. ZeroWidth only uses model hosts that keep nothing and don't train on what's sent.

## Your own model

ZeroWidth works with any OpenAI-compatible endpoint, such as Ollama, vLLM or LM Studio. With your own model on your own network, nothing leaves your network.

```Terminal
zerowidth serve --db team.db --endpoint http://localhost:11434/v1 --model llama3.1 --embed-model nomic-embed-text
```

A key for the endpoint, if the endpoint needs one, goes in `ZEROWIDTH_API_KEY`.

## Spending limits

`import`, `reversals` and `metrics --propose` are dry runs first: each shows the cost by model and reads nothing until you add `--run --cap <dollars>`, which reads up to that limit and stops.

Other commands spend as they run, with no estimate and no limit: `ingest`, `settle`, `dream`, `duplicates` and `ask`, and Dream now in the console. Use your model provider's own spending limit as well.
