{"_id":"@alkinum/replicate-cli","name":"@alkinum/replicate-cli","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@alkinum/replicate-cli","version":"0.1.1","description":"AI-first Replicate CLI for model discovery, schema inspection, predictions, artifacts, and resource management.","type":"module","license":"MIT","author":{"name":"Alkinum"},"repository":{"type":"git","url":"git+https://github.com/alkinum/replicate-cli.git"},"homepage":"https://github.com/alkinum/replicate-cli#readme","bugs":{"url":"https://github.com/alkinum/replicate-cli/issues"},"bin":{"replicate":"dist/cli.js"},"publishConfig":{"access":"public"},"engines":{"node":"^22.13.0 || >=24.0.0"},"scripts":{"build":"pnpm run clean && tsup","check":"pnpm lint && pnpm typecheck && pnpm test","clean":"node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"","dev":"tsx src/cli.ts","format":"prettier --write .","link:global":"pnpm build && pnpm add --global .","lint":"eslint .","prepack":"pnpm build","prepublishOnly":"pnpm run check","publish:public":"pnpm run check && npm publish --access public","release:check":"pnpm run check && pnpm build","release:dry-run":"pnpm run check && npm pack --dry-run","start":"tsx src/cli.ts","test":"vitest run","typecheck":"tsc --noEmit"},"dependencies":{"@inquirer/prompts":"^8.7.1","commander":"^15.0.0","zod":"^4.5.4"},"devDependencies":{"@eslint/js":"^10.0.1","@types/node":"^26.5.0","eslint":"^10.10.0","globals":"^17.12.0","prettier":"^3.9.6","tsup":"^8.5.1","tsx":"^4.23.13","typescript":"^6.0.3","typescript-eslint":"^8.69.0","vitest":"^5.0.0"},"packageManager":"pnpm@12.3.4","_id":"@alkinum/replicate-cli@0.1.1","_integrity":"sha512-W7TtKwZIT6dBPJSrpI6sgHFRjznoT6hLmAf+fqentZ2p7lEKkvQBHYoSXh4XYfHDxIX2R297RhjkkpxfYZc1Fg==","_resolved":"/var/folders/w6/4ljn0k_j0r78v3kwp1d0spkw0000gn/T/replicate-npm-first-publish-VcJkAs/alkinum-replicate-cli-0.1.1.tgz","_from":"file:/var/folders/w6/4ljn0k_j0r78v3kwp1d0spkw0000gn/T/replicate-npm-first-publish-VcJkAs/alkinum-replicate-cli-0.1.1.tgz","_nodeVersion":"26.5.0","_npmVersion":"11.18.0","dist":{"integrity":"sha512-W7TtKwZIT6dBPJSrpI6sgHFRjznoT6hLmAf+fqentZ2p7lEKkvQBHYoSXh4XYfHDxIX2R297RhjkkpxfYZc1Fg==","shasum":"e78a3331ddb0a7a2d61a9d93aa51d2386b05a01d","tarball":"https://registry.npmjs.org/@alkinum/replicate-cli/-/replicate-cli-0.1.1.tgz","fileCount":8,"unpackedSize":292895,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDrLYmWpmGd6RB/NveVD2WHn9R+BIONPw4NAaI2zgW5dwIhAInadv8tLmtP2gs4DM49IltuSFrEZD82JWqkLTULcHPr"}]},"_npmUser":{"name":"backrunner","email":"dev@backrunner.top"},"directories":{},"maintainers":[{"name":"backrunner","email":"dev@backrunner.top"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/replicate-cli_0.1.1_1788888491589_0.2267487274279667"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-08T17:28:11.441Z","0.1.1":"2026-09-08T17:28:11.732Z","modified":"2026-09-08T17:28:11.972Z"},"maintainers":[{"name":"backrunner","email":"dev@backrunner.top"}],"description":"AI-first Replicate CLI for model discovery, schema inspection, predictions, artifacts, and resource management.","homepage":"https://github.com/alkinum/replicate-cli#readme","repository":{"type":"git","url":"git+https://github.com/alkinum/replicate-cli.git"},"author":{"name":"Alkinum"},"bugs":{"url":"https://github.com/alkinum/replicate-cli/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <img src=\"docs/assets/readme-banner.svg\" alt=\"Replicate CLI — discover, inspect, run, download\" width=\"100%\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://nodejs.org/\"><img src=\"https://img.shields.io/badge/Node.js-22.13%2B-6aa875?style=flat-square\" alt=\"Node.js 22.13+\" /></a>\n  <a href=\"https://pnpm.io/\"><img src=\"https://img.shields.io/badge/pnpm-12.3.4-f9ad00?style=flat-square\" alt=\"pnpm 12.3.4\" /></a>\n  <a href=\"https://www.typescriptlang.org/\"><img src=\"https://img.shields.io/badge/TypeScript-6.x-3178c6?style=flat-square\" alt=\"TypeScript 6.x\" /></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-a3e6cc?style=flat-square\" alt=\"MIT license\" /></a>\n</p>\n\n<p align=\"center\">\n  A terminal toolkit for the <a href=\"https://replicate.com\">Replicate API</a>.<br />\n  Find a model, inspect its inputs, run a prediction, and save the results — with structured output at every step.\n</p>\n\n<p align=\"center\">\n  <a href=\"#quick-start\">Quick start</a> ·\n  <a href=\"#inputs-and-files\">Inputs &amp; files</a> ·\n  <a href=\"#commands\">Commands</a> ·\n  <a href=\"#automation\">Automation</a> ·\n  <a href=\"#development\">Development</a>\n</p>\n\n## What you can do\n\n| Workflow | Included |\n| --- | --- |\n| Discover | Search models, browse collections, inspect versions and input schemas |\n| Run | Model and deployment predictions, synchronous requests, async jobs, polling |\n| Save | Local file inputs, uploads, nested artifact downloads, `manifest.json` |\n| Manage | Models, versions, files, deployments, trainings, and account details |\n| Automate | JSON envelopes, exit codes, request previews, and a bundled agent skill |\n\n## Quick start\n\nUse Node.js **22.13+ on the 22.x line, or 24+**, and **pnpm 12.3.4**. Install the release package:\n\n```bash\npnpm add --global https://github.com/alkinum/replicate-cli/releases/download/v0.1.1/alkinum-replicate-cli-0.1.1.tgz\nreplicate --help\n```\n\nSee the [release notes](https://github.com/alkinum/replicate-cli/releases/tag/v0.1.1) or [changelog](CHANGELOG.md) for changes. To develop the CLI, install from source:\n\n```bash\ngit clone https://github.com/alkinum/replicate-cli.git\ncd replicate-cli\npnpm install\npnpm link:global\nreplicate --help\n```\n\n`pnpm link:global` builds the CLI and registers the local package globally using `pnpm add --global .`. Run it again after updating the checkout.\n\nGet a token from [Replicate](https://replicate.com/account/api-tokens), then authenticate using the hidden prompt:\n\n```bash\nreplicate auth set\nreplicate --json doctor\n```\n\nDiscover a model and inspect its inputs before running it:\n\n```bash\nreplicate --json search \"text to image\" --limit 5\nreplicate --json schema black-forest-labs/flux-schnell\nreplicate --json run black-forest-labs/flux-schnell \\\n  --input prompt=\"a tiny ceramic lighthouse on a blue desk\" \\\n  --validate-schema \\\n  --output ./out\n```\n\n`run` creates a live prediction and may incur Replicate usage charges. Add `--dry-run` to preview the request. A successful file download writes the artifacts and a `manifest.json` to `./out`.\n\n## Predictions, at your pace\n\n`run` asks the API to wait up to 60 seconds by default. A response can still be `starting` or `processing`; `--output` downloads files when the prediction has succeeded. Continue a pending prediction with `predictions wait`.\n\n```bash\n# Return immediately with a prediction ID.\nreplicate --json run black-forest-labs/flux-schnell \\\n  --input prompt=\"a paper-cut mountain landscape\" --async\n\n# Wait until completion and download the files.\nreplicate --json predictions wait <prediction-id> --output ./out\n\n# Bound the overall wait when needed.\nreplicate --json predictions wait <prediction-id> \\\n  --poll-interval 2s --timeout 10m --output ./out\n```\n\n`predictions wait` and `trainings wait` have no overall time limit unless you supply `--timeout`, which bounds both the overall wait and individual HTTP requests for these commands. The global HTTP timeout defaults to `120s`. Durations accept `250ms`, `30s`, `10m`, or `1h30m`; bare numbers mean seconds. `--wait` controls the API's synchronous wait and must be an integer from 1 to 60.\n\nPin a version or target a deployment:\n\n```bash\nreplicate --json run owner/model:version --input-json input.json\nreplicate --json run --version <version-id> --input-json input.json\nreplicate --json run --deployment owner/name --input-json input.json\nreplicate --json predictions create --model owner/model --input-json input.json --async\n```\n\n## Inputs and files\n\nRepeat `--input key=value` to pass strings, numbers, booleans, arrays, or objects. Use dotted keys for nested objects; `--set` applies after `--input`, preserving sibling fields from `--input-json`.\n\n```bash\nreplicate --json run owner/model \\\n  --input-json input.json \\\n  --input steps=4 \\\n  --input 'sizes=[512,1024]' \\\n  --set settings.seed=42 \\\n  --dry-run\n```\n\nUse `--input-file` for file inputs, including nested fields:\n\n```bash\nreplicate --json run owner/model \\\n  --input prompt=\"make it look like a watercolor\" \\\n  --input-file image=./photo.png \\\n  --output ./out\n```\n\n| `--file-mode` | Behavior |\n| --- | --- |\n| `auto` (default) | Inline local files up to 256 KiB as data URLs; upload larger files |\n| `data-url` | Inline local files as base64 data URLs |\n| `upload` | Upload local files through the Replicate files API |\n| `url` | Accept HTTP(S) URLs; reject local paths |\n\nHTTP(S) file inputs pass through unchanged in every mode. Dry runs preview local files without reading or uploading them. `--validate-schema` fetches the model schema, so it requires authentication even during a dry run. Validation checks top-level required fields, basic types, enums, nullability, and numeric bounds; it is not a full JSON Schema validator.\n\nDownload existing outputs or manage uploaded files:\n\n```bash\nreplicate --json outputs download <prediction-id> --output ./out\nreplicate --json files upload ./photo.png\nreplicate --json files list --limit 20\nreplicate --json files download '<signed-download-url>' --output ./photo.png\nreplicate --json files delete <file-id> --confirm\n```\n\n`files download` takes a signed URL, not a file ID. Artifact downloads require URLs in the model output; use `outputs print` for text output. Download generated files soon after completion, before Replicate removes them.\n\n## Commands\n\n| Command | Purpose |\n| --- | --- |\n| `doctor`, `auth`, `account` | Check connectivity and manage authentication |\n| `search`, `collections` | Discover models and curated collections |\n| `models`, `versions`, `schema` | Inspect or manage models and versions |\n| `run`, `predictions` | Create, list, inspect, wait for, and cancel predictions |\n| `outputs`, `files` | Print outputs, download artifacts, and manage uploads |\n| `trainings`, `deployments` | Manage training jobs and deployments |\n| `image`, `video`, `audio` | Convenience wrappers for model predictions |\n| `hardware`, `webhooks` | Inspect hardware and the default webhook secret response |\n| `api` | Send a raw request to the configured API origin |\n| `skill` | Print or install the bundled companion skill |\n\nUse `replicate <command> --help` for the full set of options. List commands support `--limit`, following API pagination as needed; without a limit they return one page. `search --limit` accepts 1–50 results.\n\n<details>\n<summary><strong>More examples: discovery, shortcuts, and resource management</strong></summary>\n\n```bash\n# Inspect models and versions.\nreplicate --json models query \"image editing\" --limit 10\nreplicate --json models get owner/model\nreplicate --json models examples owner/model --limit 10\nreplicate --json versions list owner/model --limit 20\nreplicate --json schema owner/model --version <version-id> --raw\n\n# Shortcuts still use the model and input schema you choose.\nreplicate --json image generate --model owner/model \"a cinematic product photo\" --output ./out\nreplicate --json image edit --model owner/model --image ./input.png --prompt \"make it neon\" --output ./out\nreplicate --json video generate --model owner/model \"a wide establishing shot\" --async\nreplicate --json audio generate --model owner/model --input-json input.json --output ./out\n\n# Preview resource changes.\nreplicate --json models create owner/model --visibility private --dry-run\nreplicate --json versions delete owner/model:version --dry-run\nreplicate --json trainings create owner/model:version \\\n  --destination owner/new-model --input-json train.json --dry-run\nreplicate --json deployments create owner/name \\\n  --model owner/model --version <version-id> --hardware <sku> --dry-run\n\n# Manage existing jobs and resources.\nreplicate --json predictions cancel <prediction-id> --confirm\nreplicate --json trainings wait <training-id> --output ./out\nreplicate --json deployments list --limit 20\nreplicate --json hardware list\n```\n\n</details>\n\n## Automation\n\nAdd `--json` before or after the command to get a structured success or error envelope on stdout. Help and version output remain plain text.\n\n```json\n{\n  \"ok\": true,\n  \"type\": \"prediction\",\n  \"data\": { \"id\": \"example-id\", \"status\": \"succeeded\" },\n  \"artifacts\": [],\n  \"meta\": { \"cliVersion\": \"0.1.1\", \"authSource\": \"env\", \"apiVersion\": \"v1\" }\n}\n```\n\n`artifacts` and `meta` fields depend on the command. Invalid arguments and failed requests produce a nonzero exit code:\n\n```json\n{\n  \"ok\": false,\n  \"error\": {\n    \"code\": \"replicate_rate_limited\",\n    \"message\": \"Request was rate limited\",\n    \"status\": 429\n  }\n}\n```\n\n| Exit code | Meaning |\n| --- | --- |\n| `0` | Command completed successfully |\n| `1` | Invalid arguments, local validation, missing confirmation, or unexpected error |\n| `2` | Missing or rejected authentication |\n| `3` | Replicate API error |\n| `4` | Failed/canceled/aborted job when waiting, or unavailable output |\n| `5` | HTTP timeout, wait timeout, or download HTTP failure |\n\n`--dry-run` previews supported writes. Model, version, deployment, and training management, cancellation, and deletion require `--confirm` for live writes. Prediction creation and file uploads run directly. Raw API requests require `--confirm` except for `GET` and `HEAD`:\n\n```bash\nreplicate --json api GET /account\nreplicate --json api POST /predictions --body-json request.json --dry-run\n```\n\n### Authentication and profiles\n\nTokens resolve in this order: **`--token` → `REPLICATE_API_TOKEN` → stored profile**.\n\n```bash\nreplicate auth set --profile work\nreplicate --json auth status --profile work\nreplicate auth clear --profile work\n```\n\nUse `REPLICATE_API_TOKEN` in CI. Stored tokens use a local JSON config with owner-only file permissions on Unix. Sensitive fields and Replicate token strings are redacted from CLI output and artifact manifests. Download requests only attach your API token to trusted Replicate HTTPS hosts.\n\n| Platform | Default config location |\n| --- | --- |\n| macOS | `~/Library/Application Support/alkinum/replicate/config.json` |\n| Windows | `%APPDATA%\\alkinum\\replicate\\config.json` |\n| Linux / Unix | `$XDG_CONFIG_HOME/alkinum/replicate/config.json`, or `~/.config/alkinum/replicate/config.json` |\n\nOverride the path with `--config <path>`. Config directories are created as needed. `auth clear` without `--profile` removes all stored profiles. Use `--base-url` to select a custom API endpoint; absolute API URLs must share that endpoint's origin.\n\n### Companion skill\n\nThe bundled [Replicate skill](skills/replicate/SKILL.md) documents discovery, schema inspection, predictions, and artifact handling for coding agents.\n\n```bash\nreplicate skill print\nreplicate skill install --target ~/.codex/skills/replicate\n```\n\n## Development\n\nThe project uses strict TypeScript 6.x, Commander, tsup, ESLint, and Vitest. `packageManager` pins pnpm to **12.3.4**. TypeScript stays on 6.x for compatibility with the ESLint toolchain.\n\n```bash\npnpm install --frozen-lockfile\npnpm dev --help\npnpm check              # Lint, typecheck, and regression tests\npnpm build              # Build dist/cli.js and its source map\npnpm release:dry-run    # Validate and inspect the npm package contents\npnpm link:global        # Rebuild and reinstall the local CLI globally\n```\n\nThe esbuild override in `pnpm-workspace.yaml` keeps the build and test toolchain on a patched release. Use `pnpm audit` and `pnpm peers check` when updating dependencies.\n\n## License\n\n[MIT](LICENSE) · An independent community CLI, unaffiliated with Replicate.\n","readmeFilename":"README.md","_rev":"1-201ef649fd8081992e1200f7ea3c7ffa"}