Skip to main content

Command line

Generate images and video from your terminal

The spicyapi command lets you browse models, check an exact price, start a generation and download the result, without writing any code. Paid commands always stop and ask first.

What the CLI is for

It is the fastest way to try a model: type a command, see the exact price, say yes, get the file. No project, no code.

  1. You type a commandTerminal or PowerShell
  2. spicyapiShows the exact price and asks first
  3. Your resultA download link, or JSON for scripts
Browsing, quoting and downloading are free. Only creating or retrying a task spends money.

Good for

  • Trying models fastCompare models and prices before anyone writes code.
  • Shell scriptsPipe --json output into jq, scheduled jobs or CI steps.
  • Coding agentsAgents can run commands and read the JSON result.

Set it up in two minutes

  1. Step 1

    Install Node.js 22.13 or later

    Run node -v. If it prints an older version, install the LTS release from nodejs.org and reopen the terminal.

    terminal
    node -v
  2. Step 2

    Put your key in SPICY_API_KEY

    The CLI reads the key from the environment only. It is never accepted as an argument and never printed, so it cannot leak through your shell history.

    export SPICY_API_KEY="sk-spicy-..."   # paste your own key
  3. Step 3

    Run it with npx, or install it once

    npx runs the latest version without installing anything. Install it globally if you use it every day.

    npx @spicyapi/cli status

Your first image from the terminal

Find a model you can call, check the exact price, then create the task and wait for it. Put the input in a file to avoid shell quoting problems.

  1. Step 1

    Find a model

    List the image models you can call, with their prices.

    models list
    spicyapi models list --modality image --json
  2. Step 2

    Check the price

    Put your prompt in a file and get the exact cost. Nothing is charged.

    tasks quote
    echo '{ "prompt": "A cinematic night portrait" }' > input.json
    spicyapi tasks quote --model MODEL_ID_FROM_CATALOG --input-file input.json
  3. Step 3

    Create and wait

    The CLI shows the price, asks for your yes, then waits for the result.

    tasks create
    spicyapi tasks create \
      --model MODEL_ID_FROM_CATALOG \
      --input-file input.json \
      --wait
  4. Step 4

    Download it

    Save the file from the result link before it expires.

    download
    curl -L -o result.png "PASTE_THE_URL_HERE"

What you can do

Only two commands spend money, and both show the price and wait for your yes.

  1. Explore

    01
    • spicyapi status

      Check that SpicyAPI is reachable

      Free
    • spicyapi models list

      List the models you can use, with prices

      Free
    • spicyapi models get <model>

      Show the exact settings one model accepts

      Free
    • spicyapi balance

      Check your balance

      Free
  2. Price

    02
    • spicyapi tasks quote

      Get the exact price before starting

      Free
  3. Generate

    03
    • spicyapi tasks create

      Start an image or video generation

      Asks before charging
    • spicyapi tasks wait <task-id>

      Wait for a generation to finish

      Free
    • spicyapi tasks get <task-id>

      Show a generation and its result links

      Free
  4. Files

    04
    • spicyapi files upload <path>

      Upload a picture, video or audio file as input

      Free
    • spicyapi files download-url <task-id>

      Get a fresh download link for a result

      Free

Built for scripts and AI agents too

Add --json to any command for the complete result as JSON, with errors as one JSON line on stderr and a non-zero exit status on failure. Coding agents can run the CLI directly, or use the MCP server for a richer integration.

--json
spicyapi --json tasks get <task-id> > task.json

Fix common errors

Most first-time problems are one of these three. Each card shows what you see and the one thing to change.

  • $

    command not found: spicyapi

    The global install is not on your PATH. Run npx @spicyapi/cli instead, or reinstall with npm install -g @spicyapi/cli.

  • key

    Key not set

    SPICY_API_KEY only lasts for the window where you set it. Set it again, or add it to your shell profile.

  • node

    Node.js is too old

    The CLI needs Node.js 22.13 or later. Check with node -v and install the current LTS release.

Questions people ask