AI agents · Command line

Let your assistant fix the stripes

Give an AI assistant or a script its own key and the unzebra command. It uploads the video, finds the stripes, makes a free 10-second sample and, once you approve the price, repairs the whole video and downloads it.

Create an agent key
  1. Create an agent and keep its key

    Sign in, open API keys and agents, name the agent and create it. The key is shown once. Put it in the assistant's environment or secret manager as:

    export UNZEBRA_AGENT_API_KEY=…

    A personal API key (starts with XJP_) works too, as UNZEBRA_API_KEY. An agent key is the better choice for an assistant: you can delete it without touching anything else.

  2. Install the command

    One file, no dependencies, Node 18 or later. ffprobe is used when it is installed, and is not required.

    mkdir -p ~/.local/bin
    curl -fsSL https://unzebra.com/agent/unzebra.js -o ~/.local/bin/unzebra
    chmod +x ~/.local/bin/unzebra
    unzebra version

    Agents that read a skill file can fetch the whole guide as Markdown from https://unzebra.com/agent/SKILL.md.

  3. Hand your assistant these instructions

    The assistant needs to be able to run shell commands. Paste this, then give it a video you are allowed to process.

    Read https://unzebra.com/agent/SKILL.md and follow it. Use the unzebra command (installed from https://unzebra.com/agent/unzebra.js) to remove recorded zebra stripes from videos I give you. UNZEBRA_AGENT_API_KEY is set in your environment; never print it. First run "unzebra repair <file>" to see where the stripes are and what the whole video costs. Run a free sample with "--sample <start>,<end>" on the worst window and show me the side-by-side file. Only run "--full --yes" after I approve the price. If a command exits 4, tell me the balance is short; if it exits 5, collect the job later with "unzebra export <job_id>".

Commands

Every command takes --json for a machine-readable answer on stdout; progress goes to stderr and --quiet silences it. Files are written to --out (default: the current folder).

unzebra repair <file> [--sample <start_s>,<end_s>] [--full] [--yes]
               [--out <dir>] [--name <stem>] [--no-wait] [--timeout <s>] [--quiet] [--json]
unzebra quote <file|upload_id> [--json]
unzebra job get <job_id> [--full] [--json]
unzebra jobs [--limit <n>] [--json]
unzebra export <job_id> [--out <dir>] [--name <stem>] [--json]
unzebra whoami [--json]
unzebra version | help

Scan a video: stripe windows and the whole-video price

unzebra repair interview.mov

Free 10-second sample of the worst window, saved to ./out

unzebra repair interview.mov --sample 42,52 --out ./out

Show the price of the whole video, without charging

unzebra repair interview.mov --full

Fix the whole video and download it

unzebra repair interview.mov --full --yes --out ./out

Price only

unzebra quote interview.mov

Submit and return at once, collect later

unzebra repair interview.mov --full --yes --no-wait --json
unzebra export <job_id> --out ./out

One job, every field

unzebra job get <job_id> --full --json

Recent jobs

unzebra jobs --limit 10

Who am I, and what is left on the balance

unzebra whoami
  • repair <file> alone uploads, scans and prints the stripe windows and the whole-video price. Nothing is charged.
  • --sample a,b repairs up to 12 seconds for free and saves the repaired clip and a side-by-side comparison.
  • --full prints the price and stops. Add --yes to charge the balance and repair the whole video.
  • export <job_id> downloads the results of a finished job again. Download links last about 15 minutes; the command fetches fresh ones each time, for 7 days after the job finished.

What it costs

  • Scanning a video is free.
  • Samples are free: up to 12 seconds each, 3 per account per day.
  • A whole video is $3.00 per minute of its length, rounded up to the next minute, with a minimum of $9.99 per video.
  • Up to 60 fps, a video is billed by its length. Above 60 fps, repair works frame by frame, so the video is billed by its frames counted at 60 frames per second: a 2-minute clip at 120 fps is billed as 4 minutes. One job takes up to 60 billed minutes.
  • One job takes up to 60 billed minutes, in files up to 16 GiB. Split longer recordings.
  • The price comes from your balance, the same one the website uses. A whole-video job that fails is returned to the balance in full.
  • The command prints the exact price before it charges anything; unzebra whoami shows the balance.
Add to balance

Exit codes

The same codes as the readvideo command, so a script can branch on them.

CodeMeaningWhat to do
0Success. Also returned when --full stops after printing the price because --yes was not given.Read stdout (use --json). If the price was printed, show it to the user and wait for approval.
1Usage error: a missing argument, an unreadable file, a file over 16 GiB, a sample window longer than 12 seconds.Fix the command. Do not retry it unchanged.
2Credential refused (401, or 403 without repair access or with a key from another site, wrong_station; a refused key exchange answers 400 invalid_grant at the auth token endpoint), or no credential found.Stop. Tell the user the Unzebra agent key is missing or no longer valid; they manage it at unzebra.com/account/api.
3The job cannot be done as asked: the repair failed, the video is too long or unreadable, the upload expired or was not found, the upload or job belongs to another account, or today's free scans or samples are used up.Do not retry the same command. Tell the user the reason printed on stderr.
4The balance does not cover the repair.Tell the user the price and that the balance is short; they add to it at unzebra.com/pricing. Run the same command again only after they say they have.
5Timed out while waiting. The job keeps running.Run the `unzebra export <job_id>` command printed on stderr, later, to collect the result. Do not start the job again.
6API or network error, including repairs being switched off for a while.Wait a few minutes and retry once. If it fails again, tell the user the service is unavailable right now.

Credentials and settings

Read in this order. The command never writes a credential to disk and never prints one.

UNZEBRA_AGENT_API_KEY
Agent key. Exchanged on every run for a short-lived token. Checked first.
UNZEBRA_API_KEY
Personal API key (starts with XJP_), sent as the Bearer token.
UNZEBRA_SECRET_REF
ns/KEY read through `xjp secret get` when neither key is set. Same as --secret-ref. Defaults to unzebra-agent/BOT_API_KEY when the xjp CLI is installed.
UNZEBRA_API_BASE
API host. Default https://asr.xiaojins.com.
UNZEBRA_AUTH_BASE
Token exchange host. Default https://auth.xiaojins.com.
UNZEBRA_CLIENT_ID
OAuth client the agent key is exchanged under. Default unzebra.
Calling the API without the command

Exchange the agent key for a short-lived token, then send it as a Bearer token. Keys and agents need the asr:user access, which new agents get when created.

curl -s https://auth.xiaojins.com/oauth2/token \
  -d grant_type=urn:xjp:bot_api_key \
  -d client_id=unzebra \
  --data-urlencode api_key="$UNZEBRA_AGENT_API_KEY"

Endpoints: POST /v1/uploads (purpose "repair"), POST /v1/uploads/{id}/complete, POST /v1/repair/jobs, GET /v1/repair/jobs/{id}, GET /v1/repair/quote?upload_id=, GET /v1/repair/jobs.

Help: support@unzebra.com, with the key id, never the key.