jq -n --arg: build a Sume video body when the prompt has quotes
Hand-quoted curl -d bodies break on a quote or backslash in the prompt. jq -n --arg escapes it right. Tested with a Wan 3.0 submit on curl 8.7.1 and jq.

A prompt like She said "go" and left C:\new\path is ordinary text for a video model and invalid JSON when you splice it into a shell string. The request fails with a parse error before it reaches anything useful. The fix is to let jq write the JSON: jq -n --arg p "$PROMPT" '{...}' escapes quotes, backslashes and newlines for you.
Checked with jq on macOS: the hand-quoted -d "{\"prompt\":\"$PROMPT\"}" body failed jq . with a parse error, and the --arg body parsed and round-tripped the prompt unchanged.
Build, then send
--argjson keeps duration a number rather than a string. The five-second 480p Wan 3.0 clip is $0.3125 on Sume (list $0.05 a second x 1.25). --data-binary @- sends the piped bytes untouched.
PROMPT='She said "go" and left C:\new\path'
jq -n --arg p "$PROMPT" --argjson d 5 \
'{model:"wan-3.0", prompt:$p, duration:$d, resolution:"480p"}' |
curl -s https://api.sume.com/v1/videos \
-H "x-api-key: $SUME_API_KEY" -H 'content-type: application/json' \
-H 'Idempotency-Key: quote-test-1' --data-binary @-Why not printf or heredoc
A heredoc with an unquoted terminator expands $ and backticks inside the prompt, and neither it nor printf escapes a double quote. Anything that interpolates user text into JSON belongs in a JSON encoder. The same applies when the prompts come from a spreadsheet or a model: encode first, send second.
If you submit many prompts, the xargs post below reads one per line from a file with null separators; it is the same idea applied to a batch.
Sources
Related posts
More in Developers
- jq one-liner: export Sume bulk queue items to CSV by index
Turn the bulk queue receipt from a curl poll into CSV rows of index, status, run_id and error code with jq, then paste them next to your SKU column.
- Kling motion control with mode webhook: a Python verifier for rotation
Submit a Kling 3.0 motion control job with mode webhook and verify the sume-v1 signature in Python, including the two-entry header during a secret rotation.
- Korean captions: language ko does not choose the style
Setting language to ko on a caption job does not switch the style. The default is black-outline; a Latin style rejects Hangul with a 400. What to send instead.
- Let browsers start Sume jobs through your server, not with your key
Browsers must never hold a Sume API key. A server route authenticates the user, checks the input, derives an Idempotency-Key and returns only the status URL.
Written by Sume