[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2591":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},2591,"nbcraft","jieyefriic\u002Fnbcraft","jieyefriic","Multi-backend image and video generation CLI — Gemini, DashScope (wan), Volcengine Ark (Seedream\u002FSeedance), OpenAI gpt-image-2.",null,"Python",155,3,6,0,1,25,44.81,"MIT License",false,"main",true,[],"2026-06-12 04:00:14","# nbcraft\n\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fnbcraft.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fnbcraft\u002F)\n[![Python versions](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fnbcraft.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fnbcraft\u002F)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](LICENSE)\n[![CI](https:\u002F\u002Fgithub.com\u002Fjieyefriic\u002Fnbcraft\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fjieyefriic\u002Fnbcraft\u002Factions\u002Fworkflows\u002Fci.yml)\n\n**`nb`** — one CLI for image and video generation across **Gemini**, **DashScope (wan)**, **Volcengine Ark (Seedream \u002F Seedance)**, and **OpenAI gpt-image-2**. Switch backends with `--model`, keep one history, no SDK juggling.\n\n```bash\npip install nbcraft\nnb config set api_key $GEMINI_API_KEY\nnb gen -p \"a tiny astronaut surfing a banana wave, neon dusk\" --ar 16:9 --res 2K\n```\n\n## Why\n\nEach provider ships a different SDK, request shape, polling protocol, and quirk. `nbcraft` papers over that:\n\n- **One `nb gen`** for 8 image models — pick speed, price, region, or text-rendering strength.\n- **One `nb video gen`** for Seedance 2.0 with submit\u002Fpoll\u002Fdownload in a single call.\n- **One history** (`~\u002F.nbcraft\u002Fhistory.json`) tracks prompts, models, outputs across all backends.\n- **No accounts you don't already have** — bring whichever API keys you have; unused backends stay dormant.\n\n## Models\n\n### Image — `nb gen --model \u003Calias>`\n\n| Alias | Backend | Model | Notes |\n|---|---|---|---|\n| `pro` (default) | Gemini | `gemini-3-pro-image-preview` | High quality |\n| `flash` | Gemini | `gemini-3.1-flash-image-preview` | Faster, cheaper |\n| `wan-pro` | DashScope 阿里云 | `wan2.7-image-pro` | T2I 4K, edit ≤2K, 9 refs |\n| `wan` | DashScope 阿里云 | `wan2.7-image` | ≤2K, faster |\n| `seedream` | Volcengine Ark 火山方舟 | `doubao-seedream-4-5-251128` | 4K, 14 refs, top text rendering |\n| `seedream-lite` | Volcengine Ark 火山方舟 | `doubao-seedream-5.0-lite` | Latest 5.0, faster\u002Fcheaper |\n| `seedream-legacy` | Volcengine Ark 火山方舟 | `doubao-seedream-4-0-250828` | 4.0 fallback |\n| `gpt` | OpenAI | `gpt-image-2` | 4K, ~99% character-level text accuracy |\n\n### Video — `nb video gen --model \u003Calias>`\n\n| Alias | Backend | Model | Notes |\n|---|---|---|---|\n| `seedance` (default) | Volcengine Ark | `doubao-seedance-2-0-260128` | High quality, ~2-3 min\u002Fclip |\n| `seedance-fast` | Volcengine Ark | `doubao-seedance-2-0-fast-260128` | ~30-60s\u002Fclip, ~36% cheaper |\n\n## Install\n\n```bash\n# Stable\npip install nbcraft\n\n# Or from source\ngit clone https:\u002F\u002Fgithub.com\u002Fjieyefriic\u002Fnbcraft\ncd nbcraft\npip install -e .\n```\n\nRequires Python 3.10+.\n\n## Configure API keys\n\n`nbcraft` reads keys from `~\u002F.nbcraft\u002Fconfig.json` first, then environment variables. Configure only the backends you actually use.\n\n```bash\n# Gemini (Google AI Studio: https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey)\nnb config set api_key \u003Ckey>          # or export GEMINI_API_KEY\n\n# DashScope 阿里云 (https:\u002F\u002Fdashscope.console.aliyun.com)\nnb config set dashscope_api_key \u003Ckey>  # or export DASHSCOPE_API_KEY\n\n# Volcengine Ark 火山方舟 (https:\u002F\u002Fconsole.volcengine.com\u002Fark)\nnb config set ark_api_key \u003Ckey>        # or export ARK_API_KEY\n\n# OpenAI (https:\u002F\u002Fplatform.openai.com\u002Fapi-keys)\nnb config set openai_api_key \u003Ckey>     # or export OPENAI_API_KEY\n```\n\n### Volcengine Ark needs extra setup ⚠️\n\nAPI key alone is not enough. In the [Ark console](https:\u002F\u002Fconsole.volcengine.com\u002Fark):\n\n1. **Activate the model service**: 系统管理 → 开通管理 → 视觉大模型 → activate Doubao-Seedream (and Seedance for video)\n2. **(Optional) Create an inference endpoint** if you prefer endpoint IDs: 在线推理 → 创建推理接入点 → copy `ep-xxx`, then `nb config set ark_endpoint_id ep-xxx`\n3. **Generate API key**: API Key 管理 → 创建\n\nIf you skip step 1, you'll get `InvalidEndpointOrModel.NotFound` on first call.\n\n### OpenAI proxy \u002F custom base URL\n\n```bash\nnb config set openai_base_url https:\u002F\u002Fyour-proxy\u002Fv1\n```\n\n## Quickstart\n\n### Image\n\n```bash\n# Gemini default\nnb gen -p \"a watercolor portrait of a librarian cat\"\n\n# Reference image + aspect ratio + resolution\nnb gen -p \"make this scene at sunset\" -i photo.jpg --ar 16:9 --res 2K -o sunset.png\n\n# Seedream 4.5 — best for posters with embedded Chinese text\nnb gen -p \"promotional poster, headline 春日上新, soft pastel\" --model seedream --ar 3:4 --res 4K\n\n# GPT Image 2 — strong character-level text + agentic reasoning\nnb gen -p \"minimalist logo with the words Stay Curious\" --model gpt --ar 1:1 --res 2K\n\n# Multi-reference fusion (Seedream up to 14)\nnb gen -p \"outfit from img 1, pose from img 2\" -i a.png -i b.png --model seedream\n\n# Generate 4 variations in parallel\nnb gen -p \"a quiet study room\" --repeat 4 -o studies.png\n# → studies_1.png, studies_2.png, studies_3.png, studies_4.png\n\n# Prompt from a file\nnb gen -p @prompt.txt --model wan-pro --res 4K\n```\n\n### Video (Seedance 2.0)\n\n```bash\n# Text-to-video, 5s, 720p, no audio (default)\nnb video gen -p \"a shiba inu turning under cherry blossoms, slow motion\" --ar 16:9\n\n# Image-to-video with first-frame\nnb video gen -p \"camera dollies in, then orbits the product\" -i product.png --duration 8\n\n# Cinema-grade 1080p with synced audio\nnb video gen -p \"a barista narrates over morning espresso\" --res 1080p --duration 10 --audio\n\n# Fast iteration draft\nnb video gen -p \"rough concept\" --model seedance-fast --duration 4\n\n# Submit only (don't wait); check later\nnb video gen -p \"...\" --no-poll\nnb video status \u003Ctask_id>\nnb video download \u003Ctask_id> -o final.mp4\n```\n\n⚠️ Generated videos expire 24 hours after they finish. With `--poll` (default) they're downloaded immediately; with `--no-poll`, run `nb video download` before the window closes.\n\n### Batch image jobs (Gemini only)\n\n```bash\n# tasks.jsonl\n# {\"key\": \"img1\", \"prompt\": \"...\", \"images\": [\"ref.png\"], \"ar\": \"3:4\", \"res\": \"2K\"}\n# {\"key\": \"img2\", \"prompt\": \"...\"}\n\nnb batch submit -f tasks.jsonl --poll -o .\u002Foutput\u002F\nnb batch list\nnb batch status \u003Cjob_name>\nnb batch download \u003Cjob_name> -o .\u002Foutput\u002F\n```\n\n### Reverse-analyze an image (Gemini only)\n\n```bash\n# Infer HTML structure from a UI screenshot\nnb rev struct -i screenshot.png -o structure.md\n\n# Describe an image\nnb rev desc -i photo.png -p \"analyze the color palette\"\n```\n\n### History and stats\n\n```bash\nnb history                    # last 20\nnb history -s \"poster\"        # filter by prompt\nnb history \u003Crecord_id>        # full JSON detail\nnb stats                      # totals, success\u002Ffail, monthly\u002Fdaily\n```\n\n## Command reference\n\n| Command | What it does |\n|---|---|\n| `nb gen` | Generate image(s) from a text prompt |\n| `nb video gen` | Generate video (Seedance 2.0) — submit + poll + download |\n| `nb video status \u003Cid>` | Check Seedance task status |\n| `nb video download \u003Cid>` | Download a finished Seedance video |\n| `nb batch submit\u002Fstatus\u002Fdownload\u002Flist` | Gemini Batch API |\n| `nb rev struct` | UI screenshot → inferred HTML structure (Gemini) |\n| `nb rev desc` | General image description (Gemini) |\n| `nb history` | Browse past generations |\n| `nb config show \u002F set` | Manage configuration |\n| `nb stats` | Usage statistics |\n\nRun `nb \u003Ccommand> --help` for full options.\n\n## Defaults you can preset\n\n```bash\nnb config set default_model flash       # Picked when --model is omitted\nnb config set default_ar 3:4\nnb config set default_res 2K\nnb config set output_dir .\u002Fout\nnb config set poll_interval 20          # Batch poll seconds\n```\n\n## Backend caveats at a glance\n\n- **Reference image limits**: Gemini 14, DashScope `wan*` 9, Seedream 14, OpenAI `gpt` 16\n- **`nb batch`** is Gemini-only (other providers don't expose comparable batch APIs)\n- **`nb rev`** is Gemini-only (the image-gen models don't do image→text)\n- **4K**: Gemini, `wan-pro` (T2I only), all Seedream, `gpt` — native; `wan` 4K downgrades to 2K\n- **Negative prompt**: native on DashScope, folded into the main prompt for Seedream\u002F`gpt`, ignored by Gemini\n- **Volcengine Ark**: API key alone is not enough — activate the model service in the console first\n\n## For Claude Code users\n\nThis repo also ships [`SKILL.md`](SKILL.md), a Claude Code skill description that lets Claude invoke `nb` automatically when you ask it to generate images. Install the skill once and Claude will pick the right model and arguments based on the request.\n\n## Development\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjieyefriic\u002Fnbcraft\ncd nbcraft\npip install -e \".[dev]\"\n\npytest                   # run tests\nruff check .             # lint\nruff format .            # format\n```\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow.\n\n## License\n\n[MIT](LICENSE)\n","nbcraft 是一个支持多种后端的图像和视频生成命令行工具，集成了 Gemini、DashScope (wan)、Volcengine Ark (Seedream\u002FSeedance) 和 OpenAI gpt-image-2。该项目通过统一的 `nb gen` 命令为用户提供跨平台的图像生成服务，以及 `nb video gen` 命令用于视频生成，支持在不同模型间无缝切换而无需管理多个 SDK。其核心功能包括单一历史记录文件以跟踪所有后端的操作，以及仅需已有 API 密钥即可使用相应服务。适用于需要灵活选择生成算法且希望简化开发流程的内容创作者或开发者。",2,"2026-06-11 02:50:26","CREATED_QUERY"]