Skip to content
Get started

CLI

Use with an AI tool

The curva binary is the server and a set of tools. It comes with pip install curva-ai, or in the Docker image.

Usage: curva <COMMAND>
Commands:
serve Run the HTTP API (POST /v1/decide, GET /health, GET /metrics)
keys Manage Curva API keys (stored hashed)
audit Check that no audited decision was changed or removed
receipt Signed decision receipts: check one offline, or rotate the signing key
project-key Give a project its own provider key (read from stdin, encrypted with CURVA_MASTER_KEY)
spike Check which models return usable label probabilities
bench Run the labeled eval sets and print accuracy, calibration, latency and cost
map Answer the same questions for every state in a JSONL file (resumable)
report Re-print a saved bench run (and its calibration) without calling any model
shadow Replay logged traffic through Curva and compare with your current system (resumable)
tune Curva Tune: search models, modes, debias, few-shot examples and plans on a labeled set
recipe Ready question packs: `list`, or `show <name>` to print one as a questions object
mcp MCP server over stdio: gives AI agents the tools decide, route, check, guard, feedback and recipes
Options:
-h, --help Print help
-V, --version Print version

Runs the HTTP API. Once any API key exists, every route but /health needs one.

Option Default Meaning
--addr <ADDR> 127.0.0.1:7777 Address to listen on
--model <MODEL> the latest pin’s model Model used when a request names neither a model nor a config
--cache-size <N> 1000 Decisions remembered per mode; repeats return in about 1 ms at no cost
--db <DB> curva.db SQLite file for decisions, feedback, calibrators, audit log and keys
--latest-config <NAME> the newest The pinned config curva-latest points to
--no-auth Allow listening beyond localhost without API keys (only on a trusted private network)
--max-body-mb <MB> 16 Largest request body accepted (inline base64 images count towards it)
--prices <FILE> CURVA_PRICES JSON file of your own model prices, used for cost_usd when the provider reports no cost; see Cost

Opens the dashboard in your browser. It serves the same API as curva serve on localhost and needs no model key just to look.

Option Default Meaning
--port <PORT> 7777 Port on 127.0.0.1
--db <DB> ~/.curva/curva.db SQLite file to show; the default is the one the SDKs write to
--no-open Print the address instead of opening a browser
--prices <FILE> CURVA_PRICES JSON file of your own model prices, used for cost_usd when the provider reports no cost; see Cost

Manages API keys, stored as hashes. All subcommands take --db <DB> (default curva.db).

Terminal window
curva keys create --name ci [--rpm 600] # prints the key once
curva keys list
curva keys revoke <ID>

--rpm is the requests per minute allowed for the key (default 600).

Terminal window
curva lessons forget # deletes every state kept for `learn`
curva lessons forget --project support # only one project's

Takes --db <DB> (default curva.db). Decisions and feedback stay; only the kept states go, so no examples are shown until new ones are learnt.

Checks that the audit log is as it was written. Takes --db <DB> (default curva.db).

Terminal window
curva audit verify # checks every audited decision, prints the head
curva audit verify --head <HASH> # also checks a head you kept from an earlier run

Every audited decision is stored with a hash of itself and of the hash of the decision written before it, so the decisions form a chain. verify walks them in the order they were written and recomputes every hash. It prints how many decisions it checked and the head, which stands for the last one and for the number of older decisions that came before the chain:

1204 decisions checked, 37 from before the audit chain not chained
head 030e82dc1a9841fe3b0a2822122309bd035cd42d147363a097132e9aff9521d6

It exits with an error that names the first decision whose hash does not match. That decision was changed, or a decision before it was changed or removed.

What this detects, and what it does not:

  • Detected: an edit to any stored field of a chained decision, and the removal of a decision from inside the chain.
  • Not detected on its own: a rewrite of the tail. Someone who can write to the database can cut off the last decisions, or change a decision and recompute the hash of every decision after it, and the chain still checks out. To catch that, keep the printed head somewhere the database’s writers cannot reach, and pass it back later with --head. verify then fails unless the chain still holds that head. Decisions added after it are fine.
  • Not covered: decisions audited before this feature (0.2.0). They have no hash, are counted as “not chained” and are skipped. Missed deadlines, feedback and API keys are not in the chain either.

The chain is safe with several Curva servers writing to the same database file.

Terminal window
curva receipt verify decision.json --key keys.json # a receipt or a whole response; - reads stdin
curva receipt rotate --db curva.db # new signing key; old receipts still verify

verify needs no server and no database: only the public key, in hex or as the JSON of GET /v1/receipts/keys. See Signed receipts.

Gives a project its own provider key, read from stdin (so it never lands in shell history) and encrypted with CURVA_MASTER_KEY. Takes --db <DB>.

Terminal window
printf %s "$OPENROUTER_KEY" | curva project-key set support
curva project-key remove support

Answers the same questions for every state in a JSONL file. See Batch files with curva map.

curva map [OPTIONS] --questions <QUESTIONS> --output <OUTPUT> <INPUT>
Option Meaning
<INPUT> One JSON state per line
-q, --questions <FILE> JSON object of questions, as in a /v1/decide request
-o, --output <FILE> One JSON result per line; rerunning continues after the last line written
--model <MODEL> A model id, or a comma-separated fallback chain
--council <A,B> Models that answer together; probabilities are blended
--cascade <A,B> Models cheapest first; unsure questions go to the next one
--race <A,B> Models asked at once; the first valid answer wins (one call each)
--escalate-below <P> Cascade: confidence below which a question is escalated (default 0.8)
--mode <MODE> auto (default), logprobs or verbal
--no-debias Skip order debiasing (half the calls; answers keep any position bias)

Replays logged traffic through Curva and compares it with your current system. See Shadow mode.

curva shadow [OPTIONS] --questions <QUESTIONS> --output <OUTPUT> <INPUT>
Option Meaning
<INPUT> One {"state": ..., "labels": {"<question>": <answer>}} per line
-q, --questions <FILE> JSON object of questions, as in a /v1/decide request
-o, --output <FILE> Curva’s answers, one JSON line per input line; rerunning continues after the last one
--compare <FIELD> Field of each input line holding the current system’s answers (default labels)
--examples <N> Disagreements listed per question (default 5)

Plus the same model options as map.

Searches models, modes, debiasing, few-shot examples and multi-model plans on a labeled set, and writes the best setup. See Curva Tune.

curva tune [OPTIONS] <SET>
Option Meaning
<SET> Name of the set (<dir>/<set>.json)
--dir <DIR> Directory of eval sets (default evals)
--models <A,B> Models to try; 2+ also tries a council and cascades
--per-set <N> Rows used, spread evenly (default: all rows)
--out <FILE> Where the winning request config is written (default tuned.json)
--yes Allow more than 200 model calls

Ready question packs. See Recipes.

Terminal window
curva recipe list
curva recipe show support-triage > questions.json

An MCP server over stdio that gives AI agents six tools: decide, route, check, guard, feedback and recipes. See MCP server.

Option Meaning
--url <URL> The Curva server (default: CURVA_BASE_URL, else one running on http://127.0.0.1:7777, else its own, started now and stopped on exit)
--api-key <KEY> Curva API key (default: CURVA_API_KEY)

Runs labeled eval sets and prints accuracy, calibration, latency and cost. See Benchmarks.

curva bench [OPTIONS] [SETS]...

Takes the same model options as map (--model, --council, --cascade, --race, --escalate-below, --mode, --no-debias), plus:

Option Meaning
[SETS]... Sets to run (default: all)
--per-set <N> Rows per set (default: all rows)
--dir <DIR> Directory of eval sets (default evals)
--save <FILE> Append every scored row to this JSONL file, to re-analyse later with curva report

Re-prints a saved bench run, including its calibration, without calling any model.

curva report [--dir <DIR>] <FILE>

Checks which models return usable label probabilities (log-probabilities over the label tokens).

curva spike [MODELS]...

Without arguments it tests the free models that list logprobs support.