Get the FREE Ultimate OpenClaw Setup Guide →
s

Civitai Generation API

Scanned

@shinnpuru

npx machina-cli add skill @shinnpuru/civitai-api-art --openclaw
Files (1)
SKILL.md
3.7 KB

CivitAI AI Art Generation

Generate AI artwork using CivitAI's official JavaScript SDK.

Prerequisites

  • Node.js 18+ environment
  • CivitAI API access token (stored in environment variable CIVITAI_API_TOKEN)
  • civitai npm package installed

Installation

npm install civitai

Usage

node scripts/get_illust.js [options]

Options

OptionDescriptionDefault
--promptMain generation prompt (required)-
--negativeNegative prompt"bad quality,worst quality,worst detail,sketch,censor"
--widthImage width832
--heightImage height1216
--seedRandom seedrandom
--stepsSampling steps20
--cfg-scaleCFG scale5
--modelModel URN identifier"urn:air:sdxl:checkpoint:civitai:827184@2514310"
--samplerSampler algorithm"Euler a"
--clip-skipCLIP skip layers2
--outputOutput file path"./output.png"
--loraLoRA network URN with optional strength (format: urn,strength)-

Example Usage

# 基础生成
node scripts/get_illust.js --prompt "1girl, red hair, blue eyes, maid outfit, smile" --output maid.png

# 高级设置
node scripts/get_illust.js \
  --prompt "1girl, long silver hair, purple eyes, magical girl, cityscape at night" \
  --negative "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet" \
  --width 1024 \
  --height 1536 \
  --steps 28 \
  --cfg-scale 6 \
  --seed 42 \
  --output magical_girl.png

# 使用不同模型
node scripts/get_illust.js \
  --prompt "fantasy landscape, floating islands, waterfalls" \
  --model "urn:air:sdxl:checkpoint:civitai:101055@128641" \
  --output landscape.png

# 使用 LoRA
node scripts/get_illust.js \
  --prompt "1girl, red hair, blue eyes, maid outfit, smile" \
  --lora "urn:air:sdxl:lora:civitai:162141@182559,0.8" \
  --output maid_with_lora.png

# 使用多个 LoRA
node scripts/get_illust.js \
  --prompt "1girl, cat ears, cute smile, IncrsAhri, multiple tails" \
  --lora "urn:air:sd1:lora:civitai:162141@182559,1.0" \
  --lora "urn:air:sd1:lora:civitai:176425@198856,0.6" \
  --output multi_lora.png

Markdown 链接示例

生成图片后,使用 markdown 格式包裹链接:

[生成的图片](https://blobs-temp.s3.us-west-004.backblazeb2.com/...)

Scheduler Options

Available sampler values:

Sampler NameEnum Value
Euler aEULER_A
EulerEULER
LMSLMS
HeunHEUN
DPM2DPM2
DPM2 aDPM2_A
DPM++ 2S aDPM2_SA
DPM++ 2MDPM2_M
DPM++ SDEDPM_SDE
DPM fastDPM_FAST
DPM adaptiveDPM_ADAPTIVE
LMS KarrasLMS_KARRAS
DPM2 KarrasDPM2_KARRAS
DPM2 a KarrasDPM2_A_KARRAS
DPM++ 2S a KarrasDPM2_SA_KARRAS
DPM++ 2M KarrasDPM2_M_KARRAS
DPM++ SDE KarrasDPM_SDE_KARRAS
DDIMDDIM
PLMSPLMS
UniPCUNIPC
LCMLCM
DDPMDDPM
DEISDEIS

Notes

  • Requires Node.js 18+ for native fetch support
  • Store API tokens securely using environment variables
  • Generated images are subject to CivitAI's terms of service
  • Some models may require specific permissions or subscriptions
  • The script always waits for job completion by default

Source

git clone https://clawhub.ai/shinnpuru/civitai-api-artView on GitHub

Overview

Generate AI artwork using CivitAI’s official JavaScript SDK. It supports Stable Diffusion models from CivitAI, including anime-style illustrations and character art, with customizable prompts, negative prompts, seeds, sampling settings, LoRA networks, and output options. Prerequisites include Node.js 18+, a CIVITAI API token, and the civitai package.

How This Skill Works

Install the civitai package and set your CIVITAI_API_TOKEN. Run the provided Node script with options like --prompt, --model, --sampler, --steps, --width/height, --seed, --lora, and --output. The script communicates with CivitAI to generate images using the selected model and sampling settings, applying LoRA networks if provided, and saves the output to the specified path.

When to Use It

  • You want anime-style character art generated from a specific CivitAI model with custom prompts.
  • You need high-resolution outputs (width/height) and precise sampling settings (steps, sampler, cfg-scale).
  • You want to test different models or LoRA networks to compare styles or strengths.
  • You want reproducible results by using a fixed seed for generation.
  • You want to apply multiple LoRA networks to a single prompt for layered effects.

Quick Start

  1. Step 1: Install civitai and set up your environment: npm install civitai
  2. Step 2: Run the generator with a prompt and output path, e.g. node scripts/get_illust.js --prompt '1girl, blue eyes' --output output.png
  3. Step 3: If needed, adjust --model, --sampler, --steps, --width/--height, --seed, and --lora, then re-run

Best Practices

  • Start with a clear base prompt and use targeted negative prompts to curb artifacts.
  • Match width/height to model capabilities and desired output quality; avoid extreme aspect ratios.
  • Use a fixed seed for reproducibility when refining prompts or comparing results.
  • Apply LoRA with conservative strength values first, then tune upward as needed.
  • Document prompt, model, sampler, and LoRA settings for easy re-generation and comparison.

Example Use Cases

  • Basic generation: node scripts/get_illust.js --prompt '1girl, red hair, maid outfit' --output maid.png
  • Advanced settings: --prompt '1girl, long silver hair, purple eyes' --negative 'lowres,...' --width 1024 --height 1536 --steps 28 --cfg-scale 6 --seed 42 --output magical_girl.png
  • Different model: --prompt 'fantasy landscape' --model 'urn:air:sdxl:checkpoint:civitai:101055@128641' --output landscape.png
  • Using LoRA: --prompt '1girl, red hair' --lora 'urn:air:sdxl:lora:civitai:162141@182559,0.8' --output maid_with_lora.png
  • Multiple LoRA: --prompt '1girl, cat ears' --lora 'urn:air:sd1:lora:civitai:162141@182559,1.0' --lora 'urn:air:sd1:lora:civitai:176425@198856,0.6' --output multi_lora.png

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers