@assethub/cli
v0.1.6
Published
Command line interface for AssetHub.
Readme
@assethub/cli
Command line interface for AssetHub.
export ASSETHUB_API_KEY=ah_live_xxx
assethub models list
assethub files import https://example.com/input.png --media-type image
assethub source create --file ./input.png --media-type image
assethub image generate --prompt "stylized prop concept" --wait
assethub mesh generate --file ./input.png --wait
assethub jobs watch job_123 --download --out-dir ./out/job
assethub parts split --file ./input.png --part-extractor "V1.5" --wait --all-ready --download --out-dir ./out/parts
assethub parts compare --file ./input.png --preprocess-prompt "clean white background, centered product photo" --part-extractor "V1.5" --wait --all-readyConfiguration:
ASSETHUB_API_KEY: optional when a profile was saved withauth login.ASSETHUB_API_BASE_URL: optional, defaults tohttps://app.assethub.io.ASSETHUB_CLI_CONFIG: optional auth config path.
Agent-friendly login:
printf '%s' "$ASSETHUB_API_KEY" | assethub auth login --api-key-stdin
assethub image generate --prompt "small stylized game asset chest" --wait --download --out-dir ./out/image
assethub mesh generate --source-url https://example.com/input.png --wait --download --out-dir ./out/mesh
cat ./character.png | assethub parts split --stdin --file-name character.png --part-extractor "V1.5" --wait --all-ready --download --out-dir ./out/parts
base64 -i ./character.png | assethub parts split --stdin-base64 --file-name character.png --content-type image/png --part-extractor "V1.5" --wait --all-ready
printf '{"image_url":{"url":"data:image/png;base64,..."}}' | assethub parts split --stdin-json --part-extractor "V1.5" --wait --all-ready
assethub parts split --clipboard --file-name character.png --part-extractor "V1.5" --wait --all-ready
cat ./character.png | assethub parts compare --stdin --file-name character.png --preprocess-prompt "clean white background" --part-extractor "V1.5" --wait --all-readyAgent-oriented input:
--file <path>uploads a local image or mesh through the public file API.--stdin --file-name <name>accepts raw piped bytes. Give a file name with an extension when possible.--stdin-base64 --file-name <name> --content-type <type>accepts raw base64 from stdin. It also accepts a fulldata:*;base64,...value.--stdin-data-uriaccepts a data URI from stdin.--stdin-jsonaccepts common agent payload shapes from stdin, including OpenAI-style{"image_url":{"url":"..."}}, Anthropic-style{"source":{"type":"base64","media_type":"image/png","data":"..."}},resourceId,fileRef,dataUri,base64,url, and localpath.--source-json <json|@file|@->parses the same JSON shapes from an argument, a file, or stdin.--data-uri <uri>acceptsdata:image/png;base64,...style inputs and uploads them before running the target command.--clipboardreads an image from the macOS clipboard for image inputs. It usespngpastewhen available and falls back to the system clipboard bridge.--source-url,--source-id/--source-resource-id, and--file-ref-jsoncan be reused across image, mesh, and part extraction commands where the API supports them.
For Codex or other AI agents, the important contract is: if the runtime can expose the attachment as bytes, base64, a data URI, a local path, an OpenAI/Anthropic-style JSON object, or a URL, the CLI can consume it directly. It does not require writing a temporary file first.
Agent-oriented output:
- stdout is one final JSON object.
- polling progress goes to stderr.
--download --out-dir <dir>recursively downloads public artifact URLs from job or production status payloads and writes amanifest.json.
assethub parts compare runs the normal part split first. When
--preprocess-prompt <text> is provided, it then uses the Nano Banana image
model to generate a preprocessed image, waits for that image job to finish, and
runs a second split on the generated image. The final JSON contains direct
and preprocessed sections so agents can compare both outputs. If
preprocessing fails, the direct result is still printed with
preprocessed.ok: false; pass --fail-on-preprocess-error when a non-zero exit
is preferred. Use --all-ready rather than explicit --task-id values when
preprocessing is enabled, because the generated-image split creates a separate
production order.
Image generation defaults to the deployed v1 endpoint. Pass --api-version v2
only when the v2 image endpoint is available in the target environment.
Part extraction uses the same public names shown in the AssetHub product:
V1, V1.5 alpha, V1.5, V2.0 alpha, and V2.1 alpha. Internal agent
IDs are intentionally not part of the public CLI interface.
The CLI only uses AssetHub's public API surface and is designed so this package can be published independently from the private application monorepo.
