nai-cli
English | 中文
nai-cli is an unofficial command-line client for NovelAI image generation. It covers text to image, image to image, inpainting, Enhance, upscaling, the Director tools and Vibes on V5, V4.5 and V4, and reads the settings stored in images so they can be generated again.
It builds requests by the same rules as the official web client, so the same settings and seed produce the same image; the parity notes list the exceptions. Every command prints JSON, one object or one line per job, which makes it easy to call from scripts and other programs.
Documentation: usage guide, official client parity, compatibility
Install
Python 3.11 or later is required:
pipx install nai-cli
This installs the nai command in an environment of its own. uv tool install nai-cli and pip install nai-cli work as well. Reading tags from images and masking objects run on your computer and need pipx install "nai-cli[local]".
Configure
Create a persistent API token in NovelAI under Account Settings (it starts with pst-), then create a config file:
nai config init
The command prints the path of the new file. Put the token in its novelai_token field, or set the NOVELAI_TOKEN environment variable instead. Once the token works, nai account shows your balance.
Usage
nai gen --prompt "1girl, rooftop, night" --dry-run
nai gen --prompt @prompt.txt --size landscape
nai inpaint --image a.png --region ellipse:0.62,0.40,0.80,0.58 --prompt "1girl, rooftop, night, open hand" --preview
nai enhance --image a.png
nai meta a.png
nai batch jobs.jsonl --dry-run
--dry-run builds and prices the request without sending anything paid. The prompt and negative fields of the output hold the final text, including the quality tags and UC preset added automatically; without --dry-run, the saved files are listed in images. @prompt.txt reads the prompt from a file. inpaint repaints an area given in fractions of the image and composites the result back onto it, and --preview saves an image marking that area before anything is sent. enhance upscales and refines an image with the settings stored in it, and meta reads those settings so that nai gen can reproduce the image. batch runs a list of commands, one per line, and prints a JSON line for each, so other programs can queue work and resume it after a failure.
nai --help lists all commands, and nai COMMAND --help shows their options. The usage guide covers each command, the output format and the error codes.
Agent skill
nai-cli includes a skill in the Agent Skills format that teaches AI agents to use it: dry-running before spending Anlas, asking before exceeding the spending limit, recovering from errors and repainting part of an image. Install it with:
npx skills add obzawa/nai-cli
This installs it for the current project; add -g to install it for all projects. The skill itself is in skills/nai-cli.
Development
See CONTRIBUTING.md for setting up, the checks a change must pass and how to report bugs; coding agents follow AGENTS.md.
Acknowledgements
Thanks to NovelAI for the models and the service. Many of the defaults and conveniences follow NAI Launcher, and image resizing is ported from Pica.
License
Third-party code and its licenses are listed in THIRD_PARTY_NOTICES.md.
Metadata
Release files for nai-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nai_cli-0.1.0.tar.gz | 321.0 kB | With provenance | Details for nai_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nai_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nai_cli-0.1.0-py3-none-any.whl |
Total release size: 537.9 kB
Release files / nai_cli-0.1.0.tar.gz
| Download URL | nai_cli-0.1.0.tar.gz |
|---|---|
| Size | 321.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b7cb66023e968b64bf29cd9523263ab22dbf7f287deffc5549aa0ce49a84256
|
|
BLAKE2b-256 checksum How to use checksums |
0f6651189053307893ffdc2a9f419aefd83518e9680afc3f9ce27263329ecd59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / nai_cli-0.1.0-py3-none-any.whl
| Download URL | nai_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 216.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29ebb988e6da4b6605a960146e41f33598bb0d012cfa39800253d78d78ecd70f
|
|
BLAKE2b-256 checksum How to use checksums |
1495baa877ff32bac4481a1fc08de5b3f6ee0fd2c6a1797b641dab4290417aa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for nai-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for nai_cli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.