Turn rough ideas into production-ready image prompts for any T2I model, with one command.
📖 Docs · 🇺🇸 English · 🇨🇳 简体中文
Limn translates plain ideas into model-optimized prompts for text-to-image generation. Pick a target model, describe what you want, and Limn rewrites your concept using that model's preferred syntax — tag‑based for SDXL, natural prose for FLUX, cinematic language for Wan‑Image, and more.
Built for developers, designers, and anyone who needs production-quality image prompts without studying each model's prompting quirks.
- One prompt, any model — FLUX, SDXL, Nano Banana Pro, Seedream‑4, Z‑Image Turbo, Chroma, Qwen Image, and Wan‑Image. Limn rewrites your idea for whichever syntax that model expects.
- Transform or generate — Optimize prompts only, or go all the way with Replicate-backed image generation. Get back a WebP file with full cost and timing analytics.
- Per-model prompt intelligence — Every model profile encodes real prompting rules: tag‑based for SDXL, prose for FLUX, reasoning‑first structure for Nano Banana Pro. No guesswork.
- Cost analytics built-in — Token counts, generation time, and OpenRouter plus Replicate costs displayed after every run. JSON output captures every number for automation.
- Smart API key management — Keys resolve from environment variables or OS keychain. No plaintext dotfiles. Secret values are redacted by default.
- Programmatic API — Call
limn(),limnGenerate(), or instantiate theLimnclass with keys passed directly. TypeScript‑first with full type coverage. - Inline image preview — Terminals that support it render the generated image inside the console after generation.
- Model catalog API —
getSupportedModelCatalog()exposes all model metadata. Drive downstream selectors and validators from Limn's canonical model definitions.
Install and generate your first image:
npm i -g @telepat/limn
limn settings set openrouterApiKey sk-or-...
limn settings set replicateApiKey r8_...
limn -m flux "a cat in space" --generateExpected outcome:
- Limn transforms your prompt into FLUX-optimized syntax via OpenRouter.
- Replicate generates and saves a timestamped
.webpto the current directory. - Cost and timing analytics are displayed after every run.
- Node.js 20+
- npm
- OpenRouter API key
- Replicate API token (for generation)
Limn loads a per-model profile that encodes the preferred prompt syntax for that T2I model. It sends your raw prompt — plus the profile's system instructions — to an LLM via OpenRouter. The LLM returns a model-optimized prompt. Optionally, Limn sends that prompt to Replicate for image generation.
Core commands:
# Transform only
limn -m sdxl "a cat in space"
# Transform and generate
limn -m flux "a cat in space" --generate
# JSON output
limn -m flux "a cat in space" --generate --json
# Custom aspect ratio
limn -m flux "a cat in space" --generate --aspect-ratio 16:9
# Override Replicate model
limn -m flux "a cat in space" --generate --replicate-model black-forest-labs/flux-2-pro
# List model options (including supported aspect ratios)
limn -m seedream-4 "a cat in space" --list-optionsAll models support 1:1, 16:9, and 9:16 universally. Each model also supports additional ratios depending on its capabilities — Limn validates the chosen ratio before sending it to Replicate, so you get a clear error immediately if the ratio is unsupported by that model.
Use --list-options on any model to see its full set of supported aspect ratios.
Per-model prompting strategies are documented in the Prompting Guide.
Limn is designed for agentic and automated workflows:
- Machine-readable output —
--jsonreturns structured JSON for both transform-only and generate runs. Every field is typed and predictable. - Programmatic API — The library exports
limn()andlimnGenerate()for functional use, plus theLimnclass for object‑oriented workflows with injected API keys. No interactive prompts required. - CI‑ready — Pass keys via
OPENROUTER_API_KEYandREPLICATE_API_TOKENenvironment variables, or through theLimnconstructor. No keychain or interactive settings command needed. - Model catalog API —
getSupportedModelCatalog()exposes canonical model metadata for downstream tooling and runtime validation.
- API keys are stored in the OS keychain by default via
limn settings. - In CI or containerized environments, use
OPENROUTER_API_KEYandREPLICATE_API_TOKENenvironment variables. - Set
LIMN_DISABLE_KEYTAR=truewhen keychain access is unavailable. limn settings listredacts secret values as***configured***.- Generated images are model-produced output. Review images before publishing.
To report a security issue, see the security policy or open a private report through the repository security flow.
Contributions are welcome. Open an issue or pull request on GitHub.
MIT. See LICENSE.