npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@oiioii/cli

v0.1.25

Published

Agent-native CLI for Oiioii / Hogi GenAI capabilities

Readme

oiioii-cli

Agent-native CLI for Oiioii / Hogi GenAI capabilities.

oiioii-cli exposes Hogi workspace creation/selection, image/video/audio generation, resource upload/download, and generation records through a scriptable command-line interface. Authentication is persisted with oiioii auth login or temporarily overridden through OIIOII_API_KEY. It supports both human-readable output and a stable JSON envelope for AI agents and automation.

Current Status

| Command | Capability | Status | |---|---|---| | auth login | Browser authorization for terminal/Codex/WorkBuddy/Kimi/Claude Code/DeepSeek, or explicit API Key persistence | Implemented | | auth status | Check configured authentication without exposing the API Key | Implemented | | auth logout | Remove locally persisted authentication without exposing the API Key | Implemented | | workspace create/set/current/rename/open/delete | Create, configure, inspect, and rename workspaces, including folder and subgroup placement | Implemented | | workspaces list / workspace list | List visible workspaces with names, conversation counts, pagination, and search in production | Implemented | | workspace folder / workspace subgroup list | Manage workspace folders and discover visible subgroup creation choices | Implemented | | workspace assets list/download | List workspace assets and download ready resources | Implemented | | workspace canvas create | Create ordered blank nodes, prompts, references, and groups without client-side layout | Implemented | | workspace canvas node update | Update prompt, generation parameters, and references on an empty canvas node | Implemented | | workspace canvas group create | Group two or more existing canvas nodes without changing their layout | Implemented | | library create/list/search/members | Create and query role, scene, item, and collection assets, including collection members | Implemented | | image text | Text-to-image generation | Implemented | | image edit | Image-to-image editing | Implemented | | media upscale-image | Existing image upscaling by 2x or 4x | Implemented | | media remove-background | General, portrait, or goods background removal | Implemented | | media image-capabilities | Image processing options and current points prices | Implemented | | video text | Text-to-video generation | Implemented | | video image | Image-to-video generation | Implemented | | video enhance | Topazlabs/Lingji video upscaling and optional Topazlabs frame interpolation | Implemented | | video generate | Model-validated mixed image/video/audio reference generation | Implemented | | audio generate/seed-audio/suno/elevenlabs | Seed Audio, Suno, and ElevenLabs audio/music generation | Implemented | | story create/list/status/cancel | Submit and manage no-interaction Story workflow tasks | Implemented | | upload resource | Upload image/video/audio resources without a workspace | Implemented | | upload file | Upload image/video/audio and attach it to a workspace | Implemented | | record get/open | Query generation metadata and download resources | Implemented | | inspect capabilities/models | Inspect declared capabilities and live backend models | Implemented | | preview latest/bundle | Read local preview bundles created by generation commands | Implemented | | task list/status/wait/retry | Inspect, wait for, and safely retry local generation tasks | Implemented | | logs list/export/path | Inspect and export structured local logs | Implemented | | points balance/quote/cost | Inspect balance, estimate a request, and query actual charges | Implemented |

Important current limitations:

  • API keys are stored in ~/.oiioii/config.json after oiioii auth login; the file is owner-readable only (0600).
  • Generation submits POST /v1/media/generations by default and returns immediately with the authoritative backend task_id plus a local_task_id.
  • The backend task ID, workspace, media type, asset ID, progress, and terminal outputs are cached in the owner-only local task store.
  • task status/wait query the stored task transport for non-terminal cached tasks and accept either the backend or local task ID.
  • Story tasks can be listed, queried, and cancelled without a local task-cache entry.
  • If submission times out or disconnects before the backend task ID is received, the task remains submitting; task retry <local_task_id> resends the saved request with the original idempotency key.
  • REST metadata requests time out after 30 seconds; raw resource uploads/downloads use a 5-minute transfer timeout; standalone video transcode polling has a 10-minute deadline.
  • Image, video, and audio generation create local preview bundles after a queried task reaches a terminal state.
  • inspect capabilities is local metadata; inspect models requires authentication and queries the active backend.
  • Style-library mutation commands are not available. Reusable asset creation, query, update, deletion, collection membership management, and workspace-scoped asset listing/download are available.

Requirements

  • Node.js 18.18 or newer when running from source or the npm package.
  • A Hogi account for browser authorization, or an existing Hogi MCP API Key.
  • A workspace ID for image/video/audio generation and upload file. It can be created with oiioii workspace create or supplied from an existing project. upload resource does not require a workspace.
  • npm is the repository package manager.

The hosted installer uses Node.js 18.18 or newer when available. If no compatible Node.js/npm installation exists, it downloads an official Node.js runtime, verifies its SHA256, and keeps it under the oiioii installation directory.

Quick Start

npm install
npm run build

node dist/cli.js --help
node dist/cli.js --version

Development mode does not require a build:

npm run dev -- --help

Install from the checkout:

npm install -g .
oiioii --help
oiioii-cli --version

Both oiioii and oiioii-cli point to the same CLI entry point.

Install from npm or the hosted bootstrap

The bootstrap scripts install the npm package into an application-owned prefix, write install.json, and create stable oiioii / oiioii-cli wrappers. CLI updates reuse the exact Node.js, npm, registry, package, and prefix recorded by the installer.

The maintained production bootstrap sources are scripts/install.sh for macOS/Linux and scripts/install.ps1 for Windows. They always follow npm's latest dist-tag. Set OIIOII_CLI_VERSION only when you need one exact stable version.

macOS (Apple Silicon and Intel are detected automatically):

curl -fsSL https://static-oiioii-sg.hogiai.cn/cli/install.sh | bash

Windows x64, from PowerShell:

$script = Join-Path $env:TEMP "install.ps1"; curl.exe -fsSL https://static-oiioii-sg.hogiai.cn/cli/install.ps1 -o $script; powershell.exe -NoProfile -ExecutionPolicy Bypass -File $script; Remove-Item $script

Test builds use scripts/test/install.sh and scripts/test/install.ps1 as maintained static-runtime installer templates. The build writes generated installers with the runtime MD5 embedded under scripts/test/dist/; they verify the runtime archive SHA-256 before installing it and do not share the production npm installer/update metadata.

After bootstrap installation:

oiioii update --check
oiioii update
oiioii install 0.2.0
oiioii versions

Local builds are intentionally excluded from npm self-update and should be rebuilt from the checkout.

Build Environments

The default backend URL and browser authorization page are embedded into the generated bundle at build time.

| Build command | Environment | Embedded default backend | Authorization page | |---|---|---|---| | npm run build:production | production | https://api.oiioii.ai (optional OIIOII_PRODUCTION_BASE_URL override) | https://oiioii.tv/auth/cli | | npm run build:test | test | OIIOII_TEST_BASE_URL from .env | Build-specific test authorization page | | npm run build:local | local | http://localhost:4000 | http://localhost:3000/auth/cli |

Use the environment-specific build entry points. Only test builds require a URL in .env:

npm run build:production
cp .env.example .env
npm run build:test

npm run build is an alias for build:production. build:test:runtime is a separate release path: it builds the test bundle, installs production-only dependencies into an isolated staging directory, verifies the embedded URL, and writes generated installers plus an MD5-addressed runtime archive and its SHA-256 checksum under the ignored scripts/test/dist/ directory.

For a custom deployment, override the embedded URL during the build:

OIIOII_BUILD_BASE_URL=https://custom.example.com npm run build:production

Supported build environment names are exactly production, test, and local. Unknown values fail the build instead of silently selecting a domain.

Publishing always rebuilds the package during npm's prepublishOnly lifecycle. Publishing rejects the one-off OIIOII_BUILD_BASE_URL override and uses the matching environment-specific variable, so an inherited custom URL cannot leak into a published package.

The embedded URL is a fallback. Existing runtime overrides remain available:

  • Root option: --base-url <url> for commands that consume the root override.
  • Environment variable: OIIOII_BASE_URL.
  • Persisted baseUrl in ~/.oiioii/config.json.

Authentication and Workspace

Authorize through the Hogi browser page for the application that launched the CLI:

oiioii auth login
oiioii auth login --codex
oiioii auth login --workbuddy
oiioii auth login --kimi
oiioii auth login --claude-code
oiioii auth login --deepseek

Without an application option, auth login opens the browser authorization page and asks the user to return to the terminal when authorization completes. The application options label the authorization for the selected host. Codex and WorkBuddy use verified macOS/Windows activation contracts; other targets print the localized manual-return fallback when no verified OS activation contract is available. The browser flow uses a loopback callback, state validation, and PKCE. It creates an API Key through the current build's backend, stores it locally, and requests that macOS or Windows return to the selected application after the hosted success page acknowledges it is ready, with a bounded fallback if that acknowledgement is blocked. If the browser or app cannot be opened, the CLI prints a localized manual fallback. Use --no-browser to print the authorization URL for a headless environment.

Browser authorization only runs against the backend paired with the current CLI build. Remove OIIOII_BASE_URL and use --reset-base-url when an older persisted override is present. For a custom backend, use the explicit --api-key mode.

You can still persist an existing MCP API Key only through the explicit --api-key mode. The CLI keeps the backend URL embedded for its build environment unless you explicitly override it:

oiioii auth login --api-key "oii_sk_..."

The CLI writes the API Key to ~/.oiioii/config.json with file permissions 0600. Pass --base-url only for an intentional backend override. OIIOII_API_KEY remains available as a temporary process override. A legacy ~/.oiioii/credentials.json file, if present, is ignored.

Check whether the current process is authenticated, or remove the locally persisted API Key:

oiioii auth status
oiioii auth logout

Neither command prints the API Key. auth status exits with status 0 when an API Key is configured for the current process and 1 when unauthenticated. It identifies only whether the credential comes from local configuration or OIIOII_API_KEY. auth logout is idempotent and preserves unrelated settings such as the Base URL and active workspace. It cannot unset an inherited OIIOII_API_KEY; when that override is present, the command reports that effective authentication remains active. If the local config is unreadable, logout removes that unusable file so credential fragments cannot remain on disk.

Remove an existing backend override and return to the default embedded in the current CLI build:

oiioii auth login --api-key "oii_sk_..." --reset-base-url

Create a workspace using the injected API Key:

oiioii workspace create \
  --name "My video project" \
  --language zh \
  --set-current \
  --json

--language accepts en, zh, zh-Hant, ja, or ko. --set-current is explicit: without it, creating a workspace does not overwrite the current workspace in local configuration.

Set and inspect the active workspace:

oiioii workspace set <workspace_id> --json
oiioii workspace current --json

Open a workspace in the browser, or retrieve its URL without opening a browser:

oiioii workspace open <workspace_id>
oiioii workspace open --no-browser --json

Workspace URLs use the authorization page's origin and /space/<workspace_id>: https://oiioii.tv/space/<workspace_id> in production. Omit the ID to use the active workspace. The browser uses its own login session; no API key is added to the URL.

List workspaces or move one workspace to the recycle bin:

oiioii workspaces list --limit 20 --search "Project" --json
oiioii workspace list --cursor <next_cursor> --json
oiioii workspace delete <workspace_id> --json

Deletion uses the same lifecycle permission as the Web: the account owner or the workspace subgroup leader. It is soft deletion, and retries preserve the original trash timestamp. Omit the ID to delete the active workspace. These commands require a backend with GET /v1/workspaces and POST /v1/workspace/delete; they do not fall back to debug or the legacy text-list endpoint.

Folder and subgroup placement is optional. Omit --subgroup to use the account's default subgroup, or pass --public to request public placement; --public and --subgroup cannot be combined. Sub-accounts can create only in their permitted subgroup. Creation preserves the active workspace unless --set-current is supplied.

oiioii workspace subgroup list --json
oiioii workspace folder list --limit 20 --json
oiioii workspace folder create --name "Project folder" --subgroup <subgroup_id> --json
oiioii workspace create --name "New project" --folder <folder_id> --subgroup <subgroup_id> --json
oiioii workspace create --name "Public project" --public --json
oiioii workspace folder get <folder_id> --json
oiioii workspace folder workspaces <folder_id> --limit 20 --json
oiioii workspace folder move <folder_id> --workspace-id <workspace_id> --json
oiioii workspace folder remove --workspace-id <workspace_id> --json
oiioii workspace folder rename <folder_id> --name "Renamed folder" --json
oiioii workspace folder favorite <folder_id> --json
oiioii workspace folder unfavorite <folder_id> --json
oiioii workspace folder trash <folder_id> --json
oiioii workspace folder restore <folder_id> --json
oiioii workspace folder purge <folder_id> --json

Folder writes and library asset deletion use POST. Upgrade the backend to one that provides the POST folder update/placement/purge and library deletion routes before upgrading the CLI. The backend retains its legacy PATCH, PUT, and DELETE routes for older clients.

List responses include has_more and, when more rows exist, next_cursor. Pass that cursor using --cursor to fetch the next page. Trashing/restoring a folder applies to its contained projects; purge permanently deletes a trashed folder and its projects.

Rename the active workspace, or pass an explicit workspace ID:

oiioii workspace rename --name "Renamed project" --json
oiioii workspace rename <workspace_id> --name "Renamed project" --json

List assets in the active workspace and download a ready asset by its workspace asset ID:

oiioii workspace assets list --json
oiioii workspace assets download <asset_id> --output ./downloads --json

workspace assets download accepts either the plain assetId or the hogi://asset/<assetId> identity returned by the list command. It resolves that identity to the asset's downloadable uri; loading, uploading, empty, failed, or URI-less assets fail before the download request. Any other hogi:// resource URI, such as an Agent-rendered hogi://video/.cache/... export, is downloaded directly without a workspace lookup.

Create blank canvas nodes and groups from a JSON file. The file contains only composition data; select the workspace with the normal root option, environment variable, local default, or the optional command argument:

{
  "nodes": [
    {
      "client_id": "cover",
      "type": "image",
      "title": "Cover",
      "prompt": "A cat based on @图片1 in a neon street",
      "generation_config": {
        "mcp_method_name": "generate_image_nanopro",
        "model_version": "nano-banana-pro",
        "ratio": "16:9",
        "resolution": "2k",
        "quality": "high"
      },
      "references": [
        { "kind": "media", "media_type": "image", "uri": "hogi://image/cat.png" }
      ]
    },
    { "client_id": "motion", "type": "video", "title": "Motion" }
  ],
  "groups": [
    {
      "client_id": "story",
      "title": "Story",
      "members": [
        { "client_node_id": "motion" },
        { "client_node_id": "cover" }
      ]
    }
  ]
}
oiioii workspace canvas create --input ./composition.json --json
oiioii workspace canvas create <workspace_id> \
  --input ./composition.json \
  --idempotency-key canvas-request-1 \
  --json

Node order follows nodes; groups[].members controls group membership order. The CLI does not accept coordinates or compute layout. Use the same explicit idempotency key only when replaying the same uncertain request. Optional generation_config caches the empty node's model selection and generation parameters for the existing Web editor. It accepts mcp_method_name, model_version, ratio, duration, resolution, and quality; a model_version requires a matching mcp_method_name. For create and node update, indexed prompt mentions are converted by the CLI to the self-contained protocol used by the Web canvas before the request is sent. @图N / @图片N address image and role/scene/item references, while @音频N and @视频N address their own media reference sequences. For example, @图片1 with hogi://image/cat.png becomes [Image:image/cat.png]. Unresolved indexes remain unchanged. OpenAPI/curl callers must send the self-contained protocol directly; this shorthand is a CLI-only capability.

Group two or more existing canvas nodes by their asset IDs:

oiioii workspace canvas group create <asset_id_1> <asset_id_2> \
  --title "Story" \
  --workspace-id <workspace_id> \
  --idempotency-key group-request-1 \
  --json

The command rejects duplicate members and nodes that already belong to another group. It changes group membership only: it does not move nodes, compute a layout, or accept coordinates. Reuse an idempotency key only for the identical workspace, member order, and title.

Update an existing empty node with explicit field options:

oiioii workspace canvas node update <asset_id> \
  --workspace-id <workspace_id> \
  --prompt "Use @图片1: a cat looking through a rainy window" \
  --model "nanopro" \
  --ratio "16:9" \
  --quality high \
  --reference 'hogi://image/<reference-id>' 'hogi://role_asset/<role-id>' \
  --json

--model resolves a configured public model name or alias through the active model catalog. Internal model IDs and provider versions are not CLI selectors. Use --clear-prompt, --clear-model, --clear-ratio, --clear-duration, --clear-resolution, --clear-quality, or --clear-references for explicit clears. Omitted options keep their existing values. The server accepts this operation only when the global enable_cli_empty_canvas_node_update flag is enabled for the caller and the current asset status is empty. URI, status, type, position, title, group, and raw metadata updates are not accepted. Completed, loading, uploading, and failed nodes are rejected.

Create, query, or search reusable library assets before generation:

oiioii library create role --name "Hero" --emo-image 'hogi://image/<expression-id>' --json
oiioii library create collection --name "Cast" --member 'hogi://role_asset/<id>' 'group:<id>' --json
oiioii library create scene --input ./scene.json --idempotency-key scene-import-001 --json
oiioii library list role --limit 20 --json
oiioii library list collection --limit 20 --json
oiioii library search role "球球" --limit 20 --json
oiioii library search collection "主要角色" --limit 20 --json
oiioii library search scene "森林" --cursor '<next_cursor>' --json
oiioii library members <collection-id> --type role --keyword "主角" --limit 20 --json
oiioii library members <collection-id> --cursor '<next_cursor>' --json
oiioii library add-members <collection-id> 'hogi://role_asset/<id>' 'group:<id>' --json
oiioii library remove-members <collection-id> 'hogi://role_asset/<id>' 'group:<id>' --json

Collection list items use their asset_id as the stable identity and return asset_uri: null. They include member_count without expanding the complete member list. Use next_cursor with --cursor to continue pagination. library members returns normalized role, scene, item, and group entries. Each entry includes an asset_ref that can be passed directly to collection member commands (hogi://<type>_asset/<id> or group:<id>). library remove-members is idempotent and applies removals against the latest Backend collection state instead of fetching and replacing the full member list from the CLI.

Use the returned asset_uri with --asset, or bind a prompt mention explicitly with --bind <name=asset-uri>. Explicit bindings avoid silently selecting the wrong asset when the library contains duplicate display names. Reuse the returned idempotency_key when retrying an uncertain create request.

Workspace resolution order is:

  1. Root --workspace <id> option.
  2. OIIOII_WORKSPACE_ID environment variable.
  3. defaultWorkspaceId in ~/.oiioii/config.json.

The CLI resolves this value locally and always sends an explicit workspace_id before making a workspace-scoped request. It never relies on the OpenAPI default-workspace lookup or creation path. If none of the three sources is set, the command fails before submission.

Image Generation

For generation commands that accept ordered media references, prompt mentions @图N / @图片N, @音频N, and @视频N are converted to self-contained [Image:...], [Audio:...], and [Video:...] placeholders before submission. Each media type has its own one-based sequence, and unresolved mentions remain unchanged. This applies to image edit, video generate / video image, reference-capable audio generate / audio seed-audio, and media create.

Text-to-image:

oiioii image text \
  --prompt "a cinematic city in the rain" \
  --model <image-model-key> \
  --resolution 2K \
  --json

oiioii image text \
  --prompt "让@球球坐在窗边" \
  --bind 球球=hogi://role_asset/<role_id> \
  --json

Image editing:

oiioii image edit \
  --image hogi://image/<id> \
  --prompt "change the scene to watercolor" \
  --model <image-model-key> \
  --resolution 2K \
  --json

For GPT Image 2 and Seedream 5.5, add --transparent to either image text or image edit to request a transparent-background PNG. Other models reject this option.

oiioii image text --prompt "an isolated sticker" --model <transparent-image-model-key> --transparent --json

Current behavior:

  • Accepts only --model <key> from inspect models; the active catalog owns the internal tool and provider version.
  • Calls POST /v1/media/generations with Bearer authentication and an idempotency header.
  • Requires an active workspace.
  • Returns after submission; use task status or task wait to query progress and terminal hogi://image/... output.
  • Image editing sends the source URI through the structured references contract.
  • When image shape options are omitted, the CLI uses the exact selected model catalog row's first aspect ratio and resolution (falling back only when the catalog leaves those fields empty).
  • Prefer --aspect-ratio for image shape. Deprecated --size WxH remains accepted for script compatibility but is hidden from help; GPT-4o receives its nearest supported pixel-size enum.

Image Upscaling and Background Removal

Use media to process an existing image. Local images must first be uploaded with upload resource; both processing commands accept hogi://image/... and use the current workspace or the root --workspace <id> override.

oiioii media image-capabilities --json
oiioii upload resource ./source.png --json

# Validate and quote without creating a task or invoking the image provider.
oiioii media upscale-image --image hogi://image/source.png --scale 4 --estimate --json
oiioii media remove-background --image hogi://image/source.png --mode goods --estimate --json

# Submit, then use the returned task_id to wait and download the result URI.
oiioii media upscale-image --image hogi://image/source.png --scale 4 --json
oiioii media remove-background --image hogi://image/source.png --mode portrait --json
oiioii task wait <task_id> --timeout 300 --json
oiioii record open hogi://image/result.png --no-open --json
  • Upscaling supports --scale 2|4, defaulting to 2.
  • Background removal supports --mode general|portrait|goods, defaulting to general. It uses the existing Tencent CI matting service; output images retain the provider's format and transparency.
  • Prices come from the same backend configuration as the canvas image tools. A bento API key without a key-specific spending limit is required. The existing worker checks balance and charges after successful processing.
  • Submission returns task_id and local_task_id. If the response is lost, use task retry <local_task_id> to resend the saved request with its original idempotency key. Starting another processing command creates a new task.
  • Results can be downloaded with record open or workspace assets download. These commands do not create canvas placeholders or add results to its asset list.

The image-processing backend exposes:

| Method | Path | Purpose | |---|---|---| | GET | /v1/media/image-enhancements/capabilities | Options and prices | | POST | /v1/media/image-enhancements/estimate | Validate and quote | | POST | /v1/media/image-enhancements | Submit; an idempotency-key header is optional | | GET | /v1/media/image-enhancements/:task_id?workspace_id=... | Query the task |

The submit/estimate body contains workspace_id, source_uri, and operation: "upscale" with scale, or operation: "remove-background" with mode. Authentication uses the OpenAPI Bearer contract. Task reads are scoped to the originating API key, account, member, and workspace.

Video Generation

Text-to-video:

oiioii video text \
  --prompt "slow camera push through neon rain" \
  --model <kling-4.0-model-key> \
  --duration 5 \
  --aspect-ratio 16:9 \
  --resolution 4k \
  --dynamic-range hdr \
  --json

Image-to-video:

oiioii video image \
  --image hogi://image/<id> \
  --prompt "animate the clouds and move the camera forward" \
  --model <video-model-key> \
  --duration 5 \
  --aspect-ratio 16:9 \
  --resolution 720p \
  --json

Mixed model-supported references:

oiioii video generate \
  --prompt "combine the visual rhythm, motion, and soundtrack references" \
  --image hogi://image/<id-1> hogi://image/<id-2> \
  --video hogi://video/<id> \
  --audio hogi://audio/<id> \
  --model <mixed-reference-video-model-key> \
  --duration 8 \
  --resolution 720p \
  --json

oiioii video generate \
  --prompt "小猫跳舞@球球" \
  --bind 球球=hogi://role_asset/<role_id> \
  --asset hogi://scene_asset/<scene_id> \
  --model <mixed-reference-video-model-key> \
  --json

# Seedance 2.5 low-cost draft/sample mode (forces 480p)
oiioii video text \
  --prompt "cinematic rain" \
  --model <seedance-2.5-model-key> \
  --draft \
  --duration 4 \
  --json

# After the draft task succeeds, submit its 1080p final video.
oiioii video finalize <draft-task-id> --json

When video duration, aspect ratio, or resolution is omitted, the CLI resolves the first supported value from the exact selected catalog row before local validation or submission, rather than applying defaults from another model.

Generation commands submit the selected public model name and do not send mcp_method_name or a top-level media_type.

Current behavior:

  • Accepts only --model <key> from inspect models; the active catalog owns the internal tool and provider version.
  • Calls POST /v1/media/generations with Bearer authentication.
  • Returns after submission; terminal video URI validation happens during task status/wait.
  • Text-to-video sends prompt, duration, aspectRatio, resolution, and optional dynamicRange with workspace_id.
  • --dynamic-range sdr|hdr is accepted only when the selected backend model contract advertises it. HDR currently requires Kling 4.0 with 1080p or 4K.
  • oiioii points quote --dynamic-range hdr applies the catalog's HDR per-second surcharge without creating a generation task.
  • Model-specific reference fields are validated locally, then sent through the structured OpenAPI references list with generateMode preserved.
  • video generate accepts zero or more --image, --video, and --audio references in the same request. --mode auto derives text2Video or omni2Video; frame semantics can be selected explicitly with --mode.
  • Seedance 2.5 omni requests accept --task-type reference|edit|extend.
  • Seedance 2.5 requests accept --draft for sample mode; the CLI rejects other models and conflicting non-480p resolutions before submission.
  • video finalize <draft-task-id> accepts the asynchronous task_id returned by the draft submission, forces the OpenAPI transport and 1080p output, and submits a separate charged final task. The backend resolves the provider draft ID and billing duration from the draft task; the provider draft already retains the approved audio and reference context.
  • --asset adds role/scene/item assets as visual references. --bind also rewrites an exact @name occurrence to [Role:<id>], [Scene:<id>], or [Item:<id>]. Workspace-asset references use OpenAPI so the backend can apply visibility checks, main-image resolution, and Seedance role head-combo selection.
  • Reference fields, combinations, and limits are validated against the selected model's resolved generation_input_contract. Call inspect models for the active account and environment instead of relying on a static model matrix.

Video Enhancement

Upscale existing videos with Topazlabs or Lingji Pro/Ultra. Tencent is not exposed.

oiioii inspect video-enhance --json
oiioii video enhance --video hogi://video/source.mp4 --provider topazlabs --resolution 4k --estimate --json
oiioii video enhance --video hogi://video/source.mp4 --provider topazlabs --resolution 4k --json
oiioii task wait <task_id> --timeout 3600 --json
oiioii record open hogi://video/result.mp4 --no-open --json

Resolutions: 720p, 1080p (default), 2k, 4k. Topazlabs also supports --frame-rate 24|30|60|90|120; omitting it preserves FPS. Without --provider, the server chooses the first enabled provider: Topazlabs, Lingji Pro, Lingji Ultra. Availability follows existing account feature flags. Source videos must already be uploaded; upload resource accepts local files.

The backend reads real video metadata, computes the existing price, and reserves points before provider execution. The first release accepts bento API keys with no key-specific spending limit; other configurations fail explicitly. Estimation creates no task. Only completed and settled cache entries are reused without a new charge. Submission returns the selected options, task IDs, reused, and no_charge. Results are resources, with no automatic canvas insertion.

An interrupted submission is saved locally; use task retry <local_task_id> with the same API key to recover the original request. A wait timeout does not cancel the backend task: query or wait on the same task again.

The API exposes GET /v1/media/video-enhancements/capabilities, POST /v1/media/video-enhancements/estimate, POST /v1/media/video-enhancements, and GET /v1/media/video-enhancements/:task_id?workspace_id=.... Submission accepts an optional Idempotency-Key header or idempotency_key body field; omitting both creates a new request with a server-generated internal key. The CLI generates and retains its key automatically for safe retry. The strict body accepts workspace_id, source_uri, optional provider, resolution, and frame_rate. See the agent reference for the full workflow. Agent usage documentation is shipped under src/skills/ in the npm package.

Audio Generation

Seed Audio text generation:

oiioii audio generate \
  --prompt "温柔女声朗读一段雨夜旁白" \
  --model <seed-audio-model-key> \
  --format mp3 \
  --subtitle \
  --json

Seed Audio 1.0 reference generation accepts up to three audio references, while Seed Audio 1.5 accepts up to six. Both versions accept one image reference by itself. Seed Audio 1.5 also accepts one video with optional reference audio.

oiioii audio generate --prompt "保持参考音色" --audio hogi://audio/<id> --json
oiioii audio generate --prompt "为画面生成氛围音" --image hogi://image/<id> --json
oiioii audio seed-audio --model seedaudio15 --prompt "根据视频节奏配音" --video hogi://video/scene.mp4 --audio hogi://audio/voice.wav --json

Suno supports description mode, custom lyrics/style mode, and instrumental music. Select the current variant through the model key returned by inspect models:

oiioii audio generate --prompt "cinematic orchestral background music" --model <suno-model-key> --instrumental --json
oiioii audio generate --prompt "custom lyrics" --model <suno-model-key> --custom --tags "dream pop, female vocal" --json

ElevenLabs v4 supports direct speech synthesis plus optional official voice, stability, language, accent, and emotion controls:

oiioii audio elevenlabs \
  --prompt "你好,这是 ElevenLabs V4。" \
  --speaker-id <voice-id> \
  --stability 0.5 \
  --json

Current behavior:

  • Accepts only --model <key> from inspect models; the active catalog owns the internal tool and provider version.
  • Seed Audio reference limits follow the selected catalog model: 1.0 accepts up to three audio references or one image, while 1.5 accepts up to six audio references or one image. Images and audio references cannot be mixed.
  • Seed Audio supports mp3, wav, pcm, and ogg_opus, plus subtitle, loudness, pitch, sample-rate, and speech-rate controls.
  • Terminal queries accept only hogi://audio/... output for audio tasks.
  • The backend async generation service owns the loading asset and final workspace update.
  • Structured logs and telemetry record model/mode/reference counts/output format/result metadata, but never prompts, request bodies, or API keys.

Generation consumes real credits. Do not run image/video/audio generation in unbounded automated loops, and do not retry failures blindly.

Story Generation

story create submits the no-interaction Story OpenAPI workflow. It creates a new workspace named by --task-name; provide exactly one script source and a style URI:

oiioii story create \
  --task-name "CLI Story" \
  --script-file ./story.txt \
  --style hogi://style/1844 \
  --wait \
  --json

Without --wait, the response returns the authoritative backend taskId and workspace ID. Query it directly without relying on local task history:

oiioii story status <task_id> --json
oiioii story list --status processing --limit 20 --json
oiioii story cancel <task_id> --json

story list returns cursor pagination for Story OpenAPI root tasks only. Cancel is idempotent for an already-cancelled task; completed and failed tasks return TASK_NOT_CANCELLABLE. Existing workspace assets are retained, and media work already submitted to a provider may finish in the background.

Use --script-uri hogi://document/... instead of --script-file for an already uploaded document. --idempotency-key supports safe replay after an ambiguous submission; reuse the same key and identical request options.

Quick Media Workflows

media is a production command for invoking the headless Quick Media Agent actions. It creates one root asynchronous task and can optionally wait for the terminal result and download the generated resources:

oiioii media create \
  --workspace-id <workspace-id> \
  --type video \
  --prompt "Animate the clouds" \
  --model <video-model-key> \
  --hogi-uri hogi://image/<id> \
  --wait \
  --download-dir ./outputs \
  --json

oiioii media status <task-id> --json

Use --model <key> for catalog-backed selection. The CLI does not expose model IDs, MCP tools, or provider versions; those values come from the selected catalog row.

Async Generation and Workspace Assets

Image, video, and audio commands submit through OpenAPI by default:

POST /v1/media/generations
GET /v1/media/generations/:task_id

The backend creates the loading workspace asset and returns its assetId and authoritative taskId. The CLI caches both IDs and the selected transport. task status/wait queries the same transport, reconciles progress/error/output into the local record, and creates the terminal preview bundle. The CLI does not issue a second create_asset call, which avoids duplicate workspace assets.

Local Resource Upload

Upload image, video, or audio bytes:

# Pure resource upload for library/collection inputs; no workspace required
oiioii upload resource ./image.png --json
oiioii upload resource ./clip.mp4 --json
oiioii upload resource ./voice.mp3 --json

# Upload and attach to the active workspace
oiioii upload file ./image.png --json
oiioii upload file ./clip.mp4 --json
oiioii upload file ./voice.mp3 --json

Override the inferred extension or display name:

oiioii upload file ./raw-file --type mp3 --name voice.mp3 --json

Insert the new asset after an existing workspace asset when ordering matters:

oiioii upload file ./voice.mp3 --after-asset-id <asset_id> --json

Upload behavior:

  • upload resource returns a reusable resource URI without updating a workspace. Small files use POST /v1/res/uploadFile; large videos use the standalone flow below.
  • upload file preserves the original workspace-bound behavior below.
  • Images, audio, and small videos use raw application/octet-stream bytes at POST /v1/workspace/uploadAsset with workspace_id, file_type, and optional file_name / after_asset_id query parameters.
  • Videos follow the web routing rules: MP4/WebM/MKV up to 12 MiB upload directly, while larger videos (up to 500 MiB) and all MOV files use the standalone /v1/res/uploadFile/* flow — the CLI uploads the original file to Volcano Engine VOD, waits for transcoding, and upload file then attaches the finished video as a workspace asset with a JSON upload_task_id request.
  • Formats outside the transcode set (for example avi, flv) always upload directly, up to 12 MiB.
  • --vod forces the standalone video flow; it is rejected for non-video files and for formats the flow cannot transcode.
  • upload file requires an active workspace and creates the asset after uploading.
  • Returns asset_id, asset_uri, file_uri, domain, workspace_id, and upload_mode ("direct" or "vod"; "vod" also returns task_id). uri remains an alias of file_uri for compatibility.
  • --attach is retained as a no-op compatibility flag because uploads are now always attached.
  • A storage or workspace-write failure fails the upload command.
  • Arbitrary URL uploads are outside the current scope.

Supported extensions:

  • Images: jpg, jpeg, png, gif, svg, webp, heic, heif, bmp, ico, tiff, jfif.
  • Video: mp4, webm, avi, mov, flv, mkv.
  • Audio: mp3, wav, ogg, m4a, aac, flac, wma, ape.

Timeline Creation from Uploaded URIs

End-to-end shell flow: upload media, take each resource URI from .data.uri, create a timeline in the given order, then bind an AI-editing conversation (requires jq):

WORKSPACE_ID="your-workspace-id"
VIDEO_URI=$(oiioii --workspace "$WORKSPACE_ID" upload file ./clip.mp4 --json | jq -r '.data.uri')
IMAGE_URI=$(oiioii --workspace "$WORKSPACE_ID" upload file ./cover.png --json | jq -r '.data.uri')
AUDIO_URI=$(oiioii --workspace "$WORKSPACE_ID" upload file ./bgm.mp3 --json | jq -r '.data.uri')
TIMELINE_JSON=$(oiioii timeline create --workspace-id "$WORKSPACE_ID" --hogi-uri "$VIDEO_URI" "$IMAGE_URI" "$AUDIO_URI" --name "My cut" --ratio 16:9 --image-duration 3 --json)
TIMELINE_ID=$(printf '%s' "$TIMELINE_JSON" | jq -r '.data.timeline_id')
TIMELINE_URI=$(printf '%s' "$TIMELINE_JSON" | jq -r '.data.timeline_uri')
CONVERSATION_ID=$(oiioii conversation create --workspace-id "$WORKSPACE_ID" --timeline "$TIMELINE_ID" --json | jq -r '.data.conversation_id')
oiioii agent run --conversation "$CONVERSATION_ID" --reference "$TIMELINE_URI" --message "加一条开场字幕" --wait --json

Images use --image-duration seconds each (default 3). Video and audio keep their own durations; audio clips are laid sequentially from 0 on their own track, independent of the visual order. Duplicate URIs are kept as separate clips; no coding project is involved. All of these commands work in production builds (agent, conversation and project are Beta). Timeline-bound CLI conversations are independent of canvas-node chats and are not automatically reused by the webpage editor.

Omit --hogi-uri to create an empty timeline (e.g. before a coding-project edit):

TIMELINE_ID=$(oiioii timeline create --workspace-id "$WORKSPACE_ID" --name "Empty cut" --json | jq -r '.data.timeline_id')
oiioii conversation create --workspace-id "$WORKSPACE_ID" --timeline "$TIMELINE_ID" --coding-project "$PROJECT_ID" --json

The backend automatically mounts conversations created with --timeline on the timeline canvas node, so opening the timeline editor reuses the same conversation and any --coding-project binding. Do not pass --target-node with --timeline. Creating another conversation for an already mounted node is rejected.

Conversation routing: codingProjectId only → 代码工程助理. Timeline-bound, mounted conversations follow the backend enable_video_editor_insert_iframe flag: enabled → 视频剪辑助理; disabled → the Planner path. When both IDs are present, the editing assistant uses the bound project's sandbox and template configuration.

Omni Remake

omni-remake create remakes 1–5 reference videos in one step: the server prepares a Hypit project and runs the coding project assistant without asking questions. Local files are uploaded to a workspace first (MP4/WebM up to 12 MiB upload directly; larger videos and all MOV files go through the standalone video transcode flow, up to 500 MiB each; a workspace is created when --workspace-id is omitted).

oiioii omni-remake create --video ./ref.mp4 --image ./hero.png --prompt "参考原视频的结构和玩法,主角换成参考图里的少女" --duration 15 --wait --json
oiioii omni-remake status <task_id>
# Cancel a preparing or running remake
oiioii omni-remake cancel <task_id>
# Follow-up edits continue in the returned conversation
oiioii agent run --conversation <conversation_id> --message "结尾延长两秒" --wait
  • Defaults: --video-model generate_video_seedance25:seedance2.5, --chat-model claude-opus-v55 (or deepseek-v4.1-flash).
  • stage: preparing (project setup) → running → completed; result.videos[] lists every saved video produced by this task (intermediate clips included), excluding the references, ordered by created_at with the newest last.
  • Failures carry error.code: result_missing, interaction_not_allowed, coding_project_failed, run_submission_failed, or internal_error. Resubmit a lost request with the idempotency_key from the error.

Agent Runs (Beta)

agent run submits a message and returns a run_id immediately; --wait follows it with short polls (each request ≤30s), so long runs are not cut off by gateway timeouts.

PROJECT_ID=$(oiioii project prepare --template hypit --wait --json | jq -r '.data.coding_project_id')
CONVERSATION_ID=$(oiioii conversation create --coding-project "$PROJECT_ID" --chat-model claude-opus-v55 --json | jq -r '.data.conversation_id')
oiioii agent run --conversation "$CONVERSATION_ID" --message "结尾延长两秒" --wait --download-dir ./out --json
  • Status: queued | running | requires_action | completed | failed | cancelled, plus end_reason: delivered | no_output | asked_user | interrupted | tool_error.
  • Exit codes: 0 completed, 1 failed/cancelled, 2 the run needs an answer or approval (required_action in the output), 3 the local --timeout elapsed while the run keeps going (oiioii agent wait <run_id>).
  • agent answer <run_id> --content ... / agent approve <run_id> [--reject] start a continuation run with a new run_id.
  • After a lost response, resubmit with the idempotency_key from the error (--idempotency-key) or find the run with oiioii conversation runs <conversation_id> --active.
  • Artifacts are attributed per run: agent artifacts list|download <run_id>.
  • --chat-model accepts claude-opus-v55 or deepseek-v4.1-flash for coding-project or timeline conversations, and is locked after the first message.

Records and Resource Download

Query generation metadata:

oiioii record get hogi://image/<id> --json
oiioii record get hogi://video/<id> --json

Download and open a resource:

oiioii record open hogi://image/<id> --json

Download without opening it:

oiioii record open hogi://video/<id> \
  --output ./downloads \
  --no-open \
  --json

record open also supports --filename <name> and --wm for a watermarked resource when supported by the backend.

Uploaded files are resources but not GenAI generation records. Use record open for an uploaded URI; record get may not find it.

Capability and Model Inspection

oiioii inspect capabilities --json
oiioii inspect models --json
oiioii inspect models --domain image --json
oiioii inspect models --domain video --json
oiioii inspect models --domain audio --json

inspect models authenticates with OIIOII_API_KEY and calls the active backend model catalog at POST /points/mcp_model_pricings. It returns actual displayable image/video/audio model records, including the model name and key, text-LLM input capabilities, reference-image bounds, points cost, supported sizes/aspect ratios/durations, descriptions, tags, and membership restrictions. MCP tool definitions are not returned.

Each model includes a unique, directly executable selector:

{
  "name": "Example Video Model",
  "key": "examplevideomodel",
  "selector": {
    "cli_args": ["--model", "examplevideomodel"]
  }
}

The top-level selection object is the machine-readable interpretation contract:

  • preferred: "model_key" tells an Agent to copy selector.cli_args into a generation command.
  • aliases_source: "active_model_catalog_name_aliases" means public aliases are owned by the model configuration API rather than by CLI code.
  • empty_input_capabilities: "unknown" means an empty list must not be treated as text-only or unsupported.
  • input_capabilities describes text-LLM input modalities; it does not determine whether an image/video/audio generation model belongs to that output domain.
  • reference_image_count_max controls reference-image support for image models. An explicit 0 disables image editing; a missing/null value follows the Hogi frontend fallback and does not reject image references.
  • generation_input_contract is the CLI's resolved per-model contract after combining model-specific image/video/audio rules with catalog reference-image bounds. Its media field lists accepted inputs, while prompt_only_supported separately states whether references may be omitted.
  • points_cost_semantics: "base_cost" means points_cost is not a final quote.
  • Duration entries are either exact seconds ("10") or inclusive ranges ("4-15").

Agents and human callers use the same --model <key> selector. Configured public names must be unique within the selected model domain. When --model is omitted, the active catalog row with the lowest sort_order is the default:

oiioii video text --prompt "cinematic rain" --model <video-model-key> --duration 5 --resolution 720p --aspect-ratio 16:9 --json

When an exact catalog selection is used, generation validates its output domain, reference-image bounds, aspect ratio, resolution, duration, and command-specific reference contract before consuming credits. input_capabilities is not used as a universal deny-list for image/video/audio generation models. The catalog internal provider version is sent to GenAI MCP as version, but is not exposed as a CLI parameter.

Points and Generation Cost

oiioii points balance --json
oiioii points quote --model <video-model-key> --duration 4 --resolution 480p --json
oiioii points cost hogi://video/example.mp4 --json
oiioii points cost --workspace-id <workspace_id> --json

points balance calls GET /v1/points/balance. The legacy MCP resource tool get_user_info remains available for existing callers. points cost calls query_generation_cost; chargedAmount is authoritative when status is charged. Because decrement ledgers commonly return a negative chargedAmount, CLI also returns positive consumed_points. A successful generation can temporarily report no_charge while the asynchronous backend settlement is still completing.

points cost --workspace-id <id> reports the net consumed_points of one workspace (generation, Agent LLM usage and freeze returns), the same total as the canvas points log, with by_type and an Agent-LLM-only by_conversation breakdown. Use it for rendered exports and Agent sessions, which have no per-URI charge.

points quote combines the authenticated user's tier with the current backend model catalog, including resolution prices, requested/reference duration and an active promotional discount. Its result always contains estimate: true and a caveat: backend feature flags, resolved media duration, promotion changes and fallback pricing can make the final charge differ. Use points cost for the settled amount.

Structured MCP errors GENAI_POINTS_INSUFFICIENT and GENAI_SUB_ACCOUNT_MONTHLY_POINTS_LIMIT_EXCEEDED map to the stable CLI code QUOTA_EXCEEDED instead of a generic generation failure.

Local Tasks and Preview Bundles

Generation commands create local task entries in:

~/.oiioii/tasks.jsonl

The current lifecycle is:

created -> submitting -> queued -> running -> succeeded | failed | cancelled

The public commands accept the cached backend ID or local ID:

oiioii task list
oiioii task status <task_id>
oiioii task wait <task_id> --timeout 300
oiioii task retry <local_task_id>

For non-terminal tasks, status makes one authenticated backend query and wait polls the backend until a terminal state or TASK_TIMEOUT. Every query uses the workspace cached with the original submission.

A network error or timeout before the CLI receives a backend task ID has an unknown submission outcome, so the local task remains submitting instead of being marked failed. Run the retry command shown in the JSON error. It reuses the original local task ID and saved submission request as the idempotency key, allowing the backend to return the already-accepted task without creating a duplicate generation. The task stores only a one-way fingerprint of the submitting API Key; retry is refused if the active credential has changed because backend idempotency is scoped to the authenticated principal. task wait fails immediately with TASK_RETRY_REQUIRED for this state instead of waiting for a backend ID that only an explicit retry can recover.

Existing preview bundles can be read with:

oiioii preview latest --json
oiioii preview bundle <task_id> --json

Bundle format:

~/.oiioii/previews/<bundle_id>/
  manifest.json
  summary.json
  artifacts/

Image, video, and audio generation invoke PreviewStore.createBundle after the local task reaches a terminal state. Preview persistence is best-effort: a local preview write failure is reported as a warning and does not turn a successful generation into a failure. When an older terminal task predates automatic preview creation, preview latest and preview bundle <task_id> lazily create the missing bundle from local task history.

JSON Output Protocol

Implemented commands support the global --json option.

Success envelope:

{
  "ok": true,
  "type": "generation_submitted",
  "data": {
    "task_id": "async_image_...",
    "local_task_id": "task_...",
    "status": "queued",
    "artifacts": []
  },
  "next": [
    { "command": "oiioii task status async_image_... --json" }
  ]
}

Error envelope:

{
  "ok": false,
  "type": "generation_failed",
  "error": {
    "code": "WORKSPACE_REQUIRED",
    "message": "No workspace set."
  }
}

Stable error codes include:

| Code | Meaning | |---|---| | AUTH_REQUIRED | OIIOII_API_KEY is missing or empty | | AUTH_INVALID | Credential rejected | | API_KEY_INVALID | Invalid API Key | | WORKSPACE_REQUIRED | No active workspace | | INVALID_ARGUMENT | Unsupported or malformed input | | GENERATION_FAILED | MCP/model generation failure | | GENERATION_TIMEOUT | Long-running request timed out | | RECORD_NOT_FOUND | Record/resource/bundle not found | | TASK_NOT_FOUND | Local task ID not found | | TASK_RETRY_REQUIRED | Submission outcome is unknown; retry the saved task with its original idempotency key | | TASK_TIMEOUT | Local task did not become terminal before the wait deadline | | QUOTA_EXCEEDED | Insufficient points, subgroup quota, or backend rate limit exceeded | | PAYLOAD_TOO_LARGE | Upload exceeds the backend limit | | CONTENT_SAFETY_BLOCKED | Prompt or reference rejected by the general content safety policy | | IP_CHARACTER_RESTRICTED | Prompt or reference may contain a restricted IP or character | | SERVER_ERROR | Invalid response or backend error | | NETWORK_ERROR | Network request failed | | NOT_IMPLEMENTED | Registered capability is not implemented | | CONFIG_ERROR | Local configuration error category |

Structured Logs

Every CLI feature creates a client-side trace through the shared logging API. The logging module owns the schema, redaction, local storage, filtering, aggregation, and export behavior; business modules never write log files directly.

A feature trace uses one trace_id from command entry to command completion:

feature.started
  -> feature.step (configuration, task, validation, local storage)
  -> api.request -> api.response | api.error
  -> feature.completed | feature.failed

Logs remain local; backend response IDs link them to server logs without downloading server logs. Recorded API events use the same clientRequestId (also stored as the backwards-compatible request_id) for local correlation:

api.request -> api.response | api.error

| Field | Meaning | | --- | --- | | id | Unique local log record ID, not a backend chain ID. | | caller_agent | Self-reported Agent source from --caller-agent; omitted when the option is not supplied. | | trace_id | One CLI command, including all of its HTTP calls. | | clientRequestId / legacy request_id | One local API call, pairing its start and result/error. | | logid | Backend chain ID read from response header x-logid. | | requestId | Current gateway request ID read from response header x-request-id; never generated by CLI. | | uid | Server request identity returned in x-hogi-log-uid, or already verified for the command's endpoint/credential. Public routes can return anonymous_user. | | workspaceId | Explicit business target, command workspace, or x-hogi-log-workspace-id from the response. |

CLI sends an optional x-workspace-id diagnostic hint. Authentication still uses the API Key; neither a client-provided uid nor a workspace hint authorizes access. Incoming response fields are optional, including when talking to older servers. Malformed/missing diagnostics and logging failures do not reject requests.

Before the response arrives, api.request cannot know its backend/gateway IDs. They appear on api.response or api.error after receiving headers. Network failures without a response legitimately have neither. Follow clientRequestId back to the start event and trace_id to other steps of the command. Command steps do not inherit the last HTTP request's logid or requestId: concurrent calls, polling and follow-up requests retain their own IDs. The REST envelope's legacy request_id is another API-generated ID, not the gateway requestId.

Resource downloads retain IDs from the backend's 302 redirect and emit api.redirect before following the CDN URL. Cross-origin redirects strip credentials and workspace hints; CDN request IDs do not replace backend IDs. Public resource reads retain their existing anonymous access/watermark behavior; an anonymous response does not erase the command's previously verified identity.

Feature traces cover workspace, image/video/audio generation, upload, records, inspection, preview, task commands, and their local storage steps. API boundary events cover:

  • GenAI and Asset MCP calls.
  • Resource upload and download.
  • Generation-record lookup.
  • Workspace REST, debug APIs, model catalog and authorization exchange.
  • Standalone video prepare, commit, and status requests (the third-party transfer is separate).

Logs contain safe operational fields such as source, operation, HTTP method, path, status, duration, and selected non-sensitive metadata. They do not record arbitrary request headers, API Keys, bearer tokens, prompts, request bodies, or response bodies. Sensitive key names and recognizable secret values are redacted again inside the central logger before persistence.

Default storage:

~/.oiioii/logs/events-<timestamp>-<pid>-<random>.jsonl

Each CLI process appends to its own file without a shared write lock, rotation, or automatic deletion. Log directories use owner-only permissions and log/export files are written with mode 0600. Logging is best-effort: a storage failure does not change the result of the API operation being logged.

List logs:

oiioii logs list --json
oiioii logs list --category api --level error --limit 20 --json
oiioii logs list --source hogi_mcp_client --since 2026-08-14T00:00:00Z --json
oiioii logs list --feature image.text --json
oiioii logs list --trace trace_<id> --json
oiioii logs list --logid <backend-logid> --json
oiioii logs list --request-id <gateway-requestId> --json
oiioii logs list --uid <uid> --workspace-id <workspaceId> --json

Export logs as JSONL or JSON:

oiioii logs export --output ./oiioii-logs.jsonl --json
oiioii logs export --output ./oiioii-logs.json --format json --json

Exports do not overwrite an existing file unless --force is supplied.

Show the log directory:

oiioii logs path --json

logs list, logs export, and logs path do not create feature-trace entries themselves, so inspecting or exporting logs does not change the result set.

DataFinder Telemetry

Remote product telemetry is centralized under src/telemetry/. Business code only calls recordTelemetryBusinessInfo, markTelemetryPartialSuccess, or setTelemetryWorkspaceId to provide safe business information. It does not import the DataRangers SDK, define event names, construct common parameters, or manage delivery.

Each executable command is mapped centrally to one business domain and emits at most two events: cli_biz_<domain>_called and cli_biz_<domain>_result. The result event records the command's total duration_ms, result (success, partial_success, failure, or timeout), and a normalized error_code on failure. There are no separate staged or technical events; latency and outcome are measured on the business result event.

The telemetry manager adds schema_version, app_env, app_name, cli_version, command, caller_agent, trace_id, workspace_id, os, arch, and node_major. caller_agent is included only when supplied through --caller-agent; workspace_id is omitted for commands without an active workspace. API Keys, tokens, prompts, file paths, and request/response bodies are dropped centrally.

Telemetry requires an explicitly identified real Hogi user ID. There is no installation-ID or anonymous fallback: until the authenticated backend UID is provided through identifyTelemetryUser, events are not sent. SDK delivery is best-effort, writes only delivery status to the local debug log, retains the command's optional caller_agent on those diagnostics, and waits for the SDK queue for a bounded period at process exit.

Global Options

--json
--base-url <url>
--workspace <id>
--caller-agent <name>
--verbose
--no-color

--verbose and --no-color are reserved global options; current output does not yet vary based on them.

Local Files and Environment Variables

Default local directory: ~/.oiioii/.

| Path | Purpose | |---|---| | config.json | API Key, backend URL, and default workspace | | tasks.jsonl | Local generation task records | | previews/ | Preview bundles created by image, video, and audio generation | | logs/events-<timestamp>-<pid>-<random>.jsonl | Append-only structured log file for one CLI process |

Environment variables:

| Variable | Purpose | |---|---| | OIIOII_CONFIG_DIR | Override the local configuration directory | | OIIOII_BASE_URL | Override the backend URL at runtime | | OIIOII_GENERATION_TRANSPORT | Select openapi (default) or the mcp rollback transport |

The MCP rollback transport preserves the legacy media-reference payload. Prompt references to role, scene, or item workspace assets require the default OpenAPI transport. | OIIOII_WORKSPACE_ID | Override the active workspace | | OIIOII_BUILD_ENV | Select production, test, or local while building | | OIIOII_PRODUCTION_BASE_URL | Optional override for the production build's canonical backend URL | | OIIOII_TEST_BASE_URL | URL embedded by the test build | | OIIOII_TEST_AUTHORIZATION_PAGE_URL | Browser authorization page embedded by the test build | | OIIOII_BUILD_BASE_URL | One-off URL override for a local/custom build; rejected by publish preparation | | OIIOII_API_KEY | Temporarily override the persisted API Key for the current process | | OIIOII_E2E | Explicit opt-in marker for credit-consuming E2E workflows | | OIIOII_LOG_DISABLED | Set to 1 to disable local logging, primarily for isolated tests | | OIIOII_TELEMETRY_DISABLED | Set to 1 to disable DataFinder telemetry |

Never commit or print real API Keys, tokens, or passwords.

Development and Verification

npm install
npm run typecheck
npm test
npm run lint
npm run build

The current local suite contains unit tests and CLI subprocess integration tests with mocked HTTP servers. There are no checked-in real-backend E2E test files at present; running the normal test command does not consume GenAI credits.

Most recent local verification for this README update:

  • 54 test files passed.
  • 454 tests passed; 2 Windows-only installer tests were skipped on macOS.
  • npm run typecheck passed.
  • npm run lint passed.
  • Production, injected test, and local build configuration passed.

Project Structure

oiioii-cli/
  src/
    cli.ts                         Commander entry point
    app/context.ts                 AppContext definition
    commands/                      CLI command wiring and workflows
    clients/                       Hogi HTTP/MCP adapters
    config/
      build_environment.ts         Build environment/domain mapping
      config_store.ts              Local configuration storage
    core/
      model_identity.ts            Generic catalog key/domain helpers
      model_selection.ts           Active catalog model selection and constraints
      task_store.ts                Local task persistence
      preview_store.ts             Preview bundle persistence
      upload_file_types.ts         Upload type/domain validation
    output/                        JSON envelopes, errors, human output
    logging/                       Log schema, redaction, storage, API spans
    telemetry/                     Event registry, common context, lifecy