Skip to main content

From question to rows in three commands

Pipe straight into jq

-j prints the raw response, so the whole result is one JSON document.
Pull just the slugs and prices out of a discover. Use price.summary rather than max_usd: a flat-priced tool has no ceiling, so max_usd on one of those is null.

Branch on the exit code

Exit 3 is the one worth handling separately in a long-running loop: it means the work is fine and the money ran out, so retrying immediately just burns requests.

Stop before you run out

Batch a file of inputs

-f - reads the input from stdin, so anything that can generate JSON can drive the CLI.

Long-running calls

Animate a local photo

--image uploads the file straight to storage and passes the handle, so the picture never has to be published anywhere and never has to be base64. The run answers with a link to the MP4 rather than the file, and that link is the model provider’s and temporary, which is why the download is in the same script.

Two workspaces on one machine

Or keep one config and switch:

CI

No setup, no config file, nothing written to disk:

Against a local gateway

Pass --api to setup and it is remembered in your config, so you only need it once per profile.

What a call actually cost

The quoted ceiling for those web.search calls was $1.00. What they cost was about a cent, because billing follows what the call actually consumed. See Pricing.