Docs

Install krei. Log in. Hand it work.

The chat is the front door — open it and hand over a task, nothing to install. The seven steps here set up the terminal: the same agent and the same hard caps, working from your shell.

01 — Install

One line puts krei on your machine.

The installer detects your OS and architecture, downloads that one build, and places the binary — nothing else is touched. Point KREI_INSTALL_DIR somewhere else if you prefer; the install page carries the full script.

krei — install
$ curl -fsSL https://krei.ai/install | bash
Binary$HOME/.local/bin/krei
Somewhere elseSet KREI_INSTALL_DIR to override the destination directory.
Awaiting youNext — 02 Log inContinueInstall page

02 — Log in

Log in once. The key stays yours.

The CLI prints a short code and opens your browser to confirm it — once the code matches, your key is stored locally. For CI, a container, or any non-interactive setup, export the key directly instead.

krei — login
$ krei login
Key at~/.krei/config.json
One key per accountSigning in on a new machine rotates the key and signs out every CLI still using the old one — or rotate it yourself from your account.
For CIExport KREI_API_KEY and skip the browser entirely.

03 — First task

Hand it a task — chat or shell.

Describe the change in plain words: krei reads the surrounding code, plans the edits, and shows each one before it touches disk. In the chat the same proposals arrive beside your message; from the repository below, the CLI works the working tree.

krei — first task
$ krei "add a retry with backoff to the fetch helper and a test"
Before anything runsYou approve, edit, or reject every edit and every command — rejecting stops it there, though proposing it has already used some credits.
What landsOrdinary diffs against your working tree — review and commit them with git as usual.

04 — Models

Same balance, whichever model.

A credit spends the same on every model in the catalog — the only thing that changes is how many requests it buys. The default is GLM-5.3; the full lineup, with per-model estimates, is on the models page.

krei — models
Defaultglm-5.3
The lineupDeepSeek V4 · GPT-6 Astra · Claude Sonnet 5 · GPT-5.6 Sol

05 — Spend cap

The cap is a hard stop, server-side.

Usage is metered in credits against your plan’s allowance. Three rolling limits — five hours, a week, a month — are hard backstops, enforced on our servers, never in your settings. When a rolling limit is spent, calls are refused until it rolls on; there is no reset day. The same windows, from the terminal:

krei — usage
$ krei usage
Windows5 h · week · month
Past the capCalls refused — HTTP 402; a request that would overshoot mid-stream is cut, not rounded up.
Other codes401 — your session expired; run krei login again. 403 — the model is not available on your plan, or there is no active subscription.

06 — Own key

Or run it on your own key.

The CLI also signs in to your own provider — any OpenAI-compatible endpoint, no krei account. Requests go from your machine straight to that endpoint, and the key is stored locally and never sent to krei. Billing is with your provider.

krei — own key
$ krei login --byok --provider openrouter
Providersopenrouter · openai · anthropic · ollama · custom — custom takes --base-url for any other OpenAI-compatible endpoint; anthropic is Anthropic's OpenAI-compatibility endpoint.
Asked, or passedWhatever you leave out is asked for — the key without echo, then a model from the provider's own list. --model and --context-window can be passed as flags. --key exists for scripts, but a key on the command line is saved in your shell history and visible in ps: prefer the prompt, or export KREI_API_KEY with KREI_MODE=byok.
Local models--provider ollama needs no key. Declare the context length your server runs with --context-window: krei's own prompt and tool definitions take a few thousand tokens of every request, and a window that cannot hold them plus 2,000 tokens of working room is refused at session start, with the size it needs. Ollama's default (4,096) is too small — raise OLLAMA_CONTEXT_LENGTH.
Plain httpA key is never sent over plain http to another machine — the login refuses before anything is sent. Use the endpoint's https URL; http://localhost is fine.
For CIKREI_MODE=byok with KREI_GATEWAY_URL (or KREI_PROVIDER), KREI_API_KEY and KREI_MODEL selects this mode for one run. Without KREI_MODE=byok, an exported KREI_API_KEY is your krei key and is never sent to a provider.
Not in this modekrei usage, the spend cap and plans belong to a krei account. Here krei usage says so, and the limits are your provider's.
Switching backkrei login signs in to krei again and leaves this mode.

07 — Help

Stuck? Write to a person.

Lost key, plan change — support sorts it out. Your key is yours: we will never ask for it, by email or by chat.

krei — where things live