surtoa
v0.1.2
Published
CLI for generating images via Surtoa imagine endpoints
Maintainers
Readme
Surtoa CLI
CLI for interacting with Surtoa function endpoints from the terminal.
Current commands:
surtoa image generatesurtoa video generatesurtoa text generatesurtoa models list
Requirements
- Node.js
>= 22
Install
After publishing to npm:
npm install -g surtoa
surtoa --helpFor local development:
Install dependencies:
npm installBuild the CLI:
npm run buildRun directly from the repo:
node dist/bin/imagine.js --helpOr link the binary locally:
npm link
surtoa --helpCommands
Image
Generate images from the /v1/function/imagine/* endpoints.
node dist/bin/imagine.js image generate \
--prompt "future city at night, neon rain, cinematic" \
--ratio 2:3 \
--count 1 \
--mode auto \
--out ./outputOptions:
--prompt <text>required--ratio <2:3|1:1|3:2|16:9|9:16>default2:3--count <1-3>default1--nsfw <true|false>defaulttrue--out <dir>default./output--function-key <key>optional--mode <auto|ws|sse>defaultauto--debug
Notes:
autotries WebSocket first and falls back to SSE when needed.- Generated images are saved into the output directory.
Video
Generate videos from the /v1/function/video/* endpoints.
node dist/bin/imagine.js video generate \
--prompt "a red apple slowly rotating on a wooden table" \
--ratio 3:2 \
--length 6 \
--resolution 480p \
--preset normal \
--out ./outputReference images can be passed either as URLs or local files.
URL example:
node dist/bin/imagine.js video generate \
--prompt "@图1 street at night, slow camera push" \
--image-url "https://example.com/ref.jpg"Local file example:
node dist/bin/imagine.js video generate \
--prompt "@图1 street at night, slow camera push" \
--image-file ./ref1.jpg \
--image-file ./ref2.pngOptions:
--prompt <text>required--ratio <3:2|2:3|16:9|9:16|1:1>default3:2--length <6-30>default6--resolution <480p|720p>default480p--preset <normal|fun|spicy|custom>defaultnormal--out <dir>default./output--function-key <key>optional--image-url <url>repeatable, max7--image-file <path>repeatable, max7--debug
Notes:
--image-urland--image-filecannot be used together.- The CLI parses progress from the SSE stream and downloads the final
mp4.
Text
Generate text from the /v1/function/chat/completions endpoint.
node dist/bin/imagine.js text generate \
--prompt "用一句话介绍你自己"With system prompt:
node dist/bin/imagine.js text generate \
--prompt "写一个三行简介" \
--system "你是一个简洁的中文写作助手"With output file:
node dist/bin/imagine.js text generate \
--prompt "写一个三行简介" \
--out ./output/result.txtWith local file attachment:
node dist/bin/imagine.js text generate \
--prompt "总结这个文件内容" \
--file ./notes.pngOptions:
--prompt <text>required--model <id>defaultgrok-4.20-beta--system <text>optional--temperature <0-2>default0.8--top-p <0-1>default0.95--file <path>optional, max1--out <path>optional--function-key <key>optional--debug
Notes:
- Output is streamed to stdout as tokens arrive.
- If
--outis provided, the final text is also written to a UTF-8 file.
Models
List models from /v1/models.
node dist/bin/imagine.js models list --function-key YOUR_KEYJSON output:
node dist/bin/imagine.js models list --function-key YOUR_KEY --jsonOptions:
--function-key <key>optional in the CLI interface, but some deployments require it--json--debug
Output
Generated files are typically written under ./output by default:
- images:
imagine_<timestamp>_<taskId>_<imageId>.<ext> - videos:
video_<timestamp>_<taskId>.mp4 - text: custom path when
--outis provided
Development
Type-check:
npm run typecheckBuild:
npm run buildRun tests:
npm testRun the full publish preflight:
npm run release:checkPublish to npm:
npm publishShow command help:
node dist/bin/imagine.js
node dist/bin/imagine.js image generate --help
node dist/bin/imagine.js video generate --help
node dist/bin/imagine.js text generate --help
node dist/bin/imagine.js models list --helpSource Layout
src/
cli/ command parsing, help, and command runners
clients/ API clients for imagine, video, text, and models
shared/ shared TypeScript types
utils/ filesystem helpers
bin/ CLI entrypoint
test/ node:test suites