Skip to main content

CLI for generating nano banana images through GRSAI

Project description

nbdraw

nbdraw is a Python CLI for generating images with GRSAI nano banana models.

nbdraw 是一个用于调用 GRSAI nano banana 模型进行绘图的 Python 命令行工具。

Features / 特性

  • nbdraw draw command for image generation
  • Config priority: file < env < CLI
  • Auto download to ./outputs by default
  • JSON output for script integration
  • Backward-compatible grsai_draw.py entry

Install / 安装

pipx (recommended)

pipx install nbdraw

pip

pip install nbdraw

Quick Start / 快速开始

  1. Copy example config to project root.
  2. Set API key by file/env/CLI.
  3. Run draw command.
cp examples/nbdraw.toml ./nbdraw.toml
nbdraw draw --prompt "professional flat vector architecture diagram"

Default outputs:

  • task_id
  • image url
  • downloaded file local_path under ./outputs

Configuration / 配置

Default search order:

  1. --config <path> if provided
  2. ./nbdraw.toml

Examples shipped in this repo:

  • examples/nbdraw.toml

Example config:

[client]
base_url = "https://grsaiapi.com"
api_key = "sk-YOUR_API_KEY"

[draw]
model = "nano-banana-pro-vip"
aspect_ratio = "16:9"
image_size = "2K"

[poll]
interval = 5.0
max_wait = 300.0
heartbeat = 15.0

Environment variables:

  • GRSAI_API_KEY
  • GRSAI_BASE_URL

CLI Examples / 命令示例

# Use prompt file
nbdraw draw --prompt-file prompt.md

# Use stdin
cat prompt.md | nbdraw draw --stdin

# Dry run payload only
nbdraw draw --prompt "test" --dry-run

# JSON output
nbdraw draw --prompt "test" --json

# Disable local download
nbdraw draw --prompt "test" --no-download

Backward Compatibility / 向后兼容

Old command still works:

python grsai_draw.py --prompt "test"

It calls the new implementation and prints a deprecation notice.

Development / 开发

python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
ruff check .
pytest
python -m build

Or use conda:

conda activate nbdraw
pip install -e '.[dev]'
ruff check .
pytest
python -m build

CI & Release

  • CI: lint + tests + package build
  • Release: push tag v* to trigger PyPI publish via GitHub Actions Trusted Publisher

Migration Notes / 迁移说明

  • Keep old options unchanged where possible.
  • Recommended config:
cp examples/nbdraw.toml ./nbdraw.toml
  • New options:
    • --output-dir
    • --no-download
    • --json

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbdraw-0.1.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbdraw-0.1.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file nbdraw-0.1.1.tar.gz.

File metadata

  • Download URL: nbdraw-0.1.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbdraw-0.1.1.tar.gz
Algorithm Hash digest
SHA256 646d4a1f1acb2f2f834bf89a182fe20693237ef1aa7817cee7d2402a71da0b72
MD5 cb1478fad748deb592e0711b7d029ca4
BLAKE2b-256 cb5df29c1be31f747b0ec36e2a735a3f60320e18967d0afeacf474dfbcd997b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbdraw-0.1.1.tar.gz:

Publisher: release.yml on yiz-hhh/nbdraw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbdraw-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nbdraw-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbdraw-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1552e36afbb47449952e40d0176fe6cd7d3ec7cca6b4aa1adec0e4874e2f744b
MD5 d88c73fbd75fba28acc38f89ed946fb8
BLAKE2b-256 5ae895842f9a7d44c5420f7d2c83a337ce4454e8eae9fa40aa5cf47da97e9a34

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbdraw-0.1.1-py3-none-any.whl:

Publisher: release.yml on yiz-hhh/nbdraw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page