# Evanorma — CLI and API guide (for people and for agents)

Evanorma (https://evanorma.app) is a research platform. Everything a signed-in user can do on the website can also be done from a
script or an agent, with an **API token** and either the `evn` command line tool or plain HTTP.

- This page for people: https://evanorma.app/docs
- This page as markdown (for agents): https://evanorma.app/docs.md  (also `https://evanorma.app/llms.txt`)
- 中文版: https://evanorma.app/docs.zh.md
- Full reference of the figure API: https://figure.evanorma.app/llms.txt

## 1. Levels: who may do what

| Level | Who | May do |
|---|---|---|
| 0 Free | not signed in, no token | browse every page, open share links, run the built-in examples, download and export existing results |
| 1 Enterprise | signed in with the company Feishu account | everything: draw figures, revise, chat, publish; see their own API cost |
| 2 Developer | developer accounts | everything in level 1, the Eva channel, and everyone's API cost |

A token has exactly the level of the user who made it, and the API cost of what it starts is billed to that user.
Drawing costs real money (roughly $2–4 per figure in mode A, $0.7–2.5 in mode B), so do not start jobs you do not need.

## 2. Get a token

1. Sign in on https://evanorma.app (top-right "Login").
2. Click **API** in the top-right bar, type a label (for example the agent's name) and press "New token".
3. Copy the token (`evn_…`). It is shown once. You can revoke it in the same panel at any time; up to 10 tokens per user.

Tokens are created and revoked on the website only: a token cannot create or revoke tokens.
Treat a token like a password. Do not paste it into chats, commit it, or put it in a URL.

## 3. The `evn` command line tool

One file, Python 3.8+, standard library only.

```bash
curl -fsSL https://evanorma.app/cli/evn -o ~/.local/bin/evn && chmod +x ~/.local/bin/evn
evn login evn_xxxxxxxx        # saves the token to ~/.config/evanorma/token (mode 600)
evn me                        # -> name and level
```

Instead of `evn login`, set `EVANORMA_TOKEN=evn_…` in the environment (better for agents and CI).
Every command accepts `--json` to print the raw JSON instead of text. Exit codes: 0 ok, 1 error, 2 not allowed
(missing / invalid token, or the level is too low), 3 timed out while waiting.

### Draw a figure

Jobs are asynchronous: a figure takes 5–30 minutes. Either start it and come back, or pass `--wait`.

```bash
# from a description of the content (do not describe layout)
evn draw text "A two-stage RAG pipeline: the question is encoded, top-5 documents are retrieved from a vector DB, a frozen LLM writes the answer. The retriever is new." --wait -o out/

# rebuild an existing image as an editable vector figure
evn draw recon figure.png --wait -o out/

# polish an image, or redraw it in another style
evn draw restyle figure.png --wait -o out/
evn draw restyle figure.png --style-example <style id> --prompt "bluer palette, bigger title"
evn draw restyle figure.png --style-image reference.png

# combine aspects of several images; refer to them as 【图片1】【图片2】… in order
evn draw compose "用【图片1】的整体构造，【图片2】的配色；内容：三阶段 RLHF 流程" a.png b.png --wait -o out/

# redraw every figure of a paper (optionally in the style of another paper)
evn draw paper paper.pdf --target-pdf style.pdf --wait -o out/ --fmt pptx,pdf
```

Options: `--mode A|B` (A quality first, default; B economy) · `--wait` · `--timeout SECONDS` (default 2400) ·
`-o DIR` download results when finished · `--fmt pptx,svg,pdf,png` (default `pptx,svg`) · `--sample ID` use a built-in
example instead of a file (`evn examples` lists the ids; built-in examples return instantly and cost nothing).

Without `--wait`, `evn draw` prints the job id and returns at once.

### Follow, download, revise, share

```bash
evn status JOB                      # state of the job and each item, cost so far, share link
evn wait JOB -o out/                # block until finished, then download
evn download JOB -o out/ --fmt pptx,svg,pdf,png [--item N] [--version N]
evn revise JOB "Make the gap between the LLM box and the Answer box larger; recolor the Vector DB block blue." --wait -o out/
evn publish JOB                     # put it in the public gallery and show how it was made;  --off to undo
```

Files are saved as `<job>_<item>_v<version>.<format>`. Every job has a read-only share page anyone can open:
`https://figure.evanorma.app/s/<job id>`.

Revision feedback should be concrete ("increase the gap between X and Y", "make block Z red"). Each revision builds on the
previous version; all versions are kept (up to 50).

### Chat about a paper

```bash
evn chat new --pdf paper.pdf                          # -> chat id
evn chat send CHAT "Draw a teaser figure in the style of Fig. 3" --wait
evn chat send CHAT "Make the boxes lighter" --image sketch.png --wait
evn chat show CHAT                                    # messages; a bot message that made a figure carries its job id
```

A reply takes 1–3 minutes; a drawing started by the chat is an ordinary job (`evn wait JOB -o out/`).

### Account

```bash
evn me              # name, level
evn billing         # API cost billed to you (developers also see every user)
evn logout          # forget the token on this machine
```

### Anything else

```bash
evn api GET /api/gallery                       # raw call to the figure API
evn api POST /api/job '{"kind":"text","text":"…"}'
evn api GET /auth/me --main                    # raw call to evanorma.app
```

## 4. Plain HTTP

Send the token on every request:

```
Authorization: Bearer evn_xxxxxxxx
```

JSON in, JSON out. Errors are `{"error": "…"}` with HTTP 400 (bad request, or the level is too low for this action — the
message says so, often in Chinese), 401 (invalid or revoked token) or 404.

### evanorma.app (account)

| Call | Returns |
|---|---|
| `GET https://evanorma.app/auth/me` | `{"name","level","via"}`; `{"level":0}` when not signed in |
| `GET https://evanorma.app/auth/billing` | `{"me":{"usd","jobs","chats","by_stage"}}`; developers also get `users` and `unattributed_usd` |

### figure.evanorma.app (paper figures)

| Call | What it does | Level |
|---|---|---|
| `GET /api/examples` | built-in samples, styles, papers | 0 |
| `POST /api/job` | start a job (`kind`: `text`, `recon`, `restyle`, `compose`, `paper`) → `{"id"}` | 1 (built-in examples: 0) |
| `GET /api/job/<id>` | status, items, versions, cost | 0 |
| `GET /f/<job>/<item>/<version>/<pptx\|svg\|pdf\|png\|preview>` | download one version | 0 |
| `GET /zip/<job>/<format>` | newest version of every finished item | 0 |
| `POST /api/job/<id>/revise` | `{"item":0,"feedback":"…"}` → new version | 1 |
| `POST /api/job/<id>/publish` | `{"published":true\|false}` | 1 |
| `POST /api/chat`, `POST /api/chat/<id>/message`, `GET /api/chat/<id>` | chat mode | 1 (reading: 0) |
| `GET /api/gallery` | published work | 0 |
| `POST /api/svg/export`, `POST /api/job/<id>/theme` | convert / recolor existing figures | 0 |

Request bodies, response fields, limits and timing are in the full reference: https://figure.evanorma.app/llms.txt

```bash
# minimal example with curl
T="Authorization: Bearer $EVANORMA_TOKEN"
JOB=$(curl -s -H "$T" -H 'content-type: application/json' -d '{"kind":"text","text":"A two-stage RAG pipeline …"}' https://figure.evanorma.app/api/job | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')
curl -s -H "$T" https://figure.evanorma.app/api/job/$JOB        # poll every 5–10 s until status is done or failed
curl -s -H "$T" -o figure.pptx https://figure.evanorma.app/f/$JOB/0/1/pptx
```

## 5. Notes for agents

- Create → poll → download. Never hold one HTTP request open for a job; poll every 5–10 s (`evn wait` does this).
- Check `evn me --json` first: level 0 means the token is missing or wrong, and anything that costs money will be refused.
- Every job you start is billed to the token's owner. Prefer `--mode B` for drafts, reuse a job with `evn revise` instead of
  starting over, and use `--sample` examples to test your integration for free.
- Results are kept for a limited time: download what you need.
- Do not send secrets or confidential material: content is processed by AI models and by agents on the server.
- Descriptions and feedback may be in any language; write them in the language you want inside the figure.
- The Eva channel (https://evanorma.app/eva) is in development and has no API yet.
