Skip to content

Director Tools

Director Tools provide image augmentation and tag suggestion features.

Augment Image

Use the augmentImage method to augment images:

typescript
import { NovelAI } from 'novelai-sdk-unofficial';
import { readFileSync, writeFileSync } from 'fs';

const client = new NovelAI({ apiKey: 'your-api-key' });

// Background removal
const images = await client.image.augmentImage({
  image: readFileSync('input.png'),
  type: 'bg-removal',
  width: 1024,
  height: 1024,
});

writeFileSync('output.png', images[0]);

Supported Augmentation Types

typeDescription
bg-removalBackground removal
lineartLine art extraction
sketchSketch style
colorizeColorization
emotionEmotion transformation
declutterDeclutter

Parameters

ParameterTypeRequiredDescription
imageBuffer | string | ArrayBufferYesInput image
typeAugmentTypeYesAugmentation type
widthnumberYesOutput width (must match input image width)
heightnumberYesOutput height (must match input image height)
promptstringNoPrompt (for types like colorize)
defrynumberNoDefry level (0-5)

Note

width and height must match the actual dimensions of the input image, otherwise the API will return a 500 error.

Colorization Example

typescript
const colorized = await client.image.augmentImage({
  image: readFileSync('sketch.png'),
  type: 'colorize',
  width: 1024,
  height: 1024,
  prompt: 'vibrant colors, detailed shading',
});

Suggest Tags

Use the suggestTags method to get tag suggestions:

typescript
import { NovelAI } from 'novelai-sdk-unofficial';

const client = new NovelAI({ apiKey: 'your-api-key' });

// Get tag suggestions
const tags = await client.image.suggestTags({
  prompt: '1girl, blue',
});

for (const tag of tags) {
  console.log(`${tag.tag}: ${tag.confidence} (${tag.count})`);
}

Parameters

ParameterTypeDefaultDescription
promptstringrequiredIncomplete tag query
modelImageModel'nai-diffusion-4-5-full'Image model
lang'en' | 'jp''en'Language

Return Value

typescript
interface TagSuggestion {
  tag: string;        // Suggested tag
  confidence: number; // Confidence score
  count: number;      // Usage count
}

Japanese Tag Suggestions

typescript
const tags = await client.image.suggestTags({
  prompt: '女の子',
  lang: 'jp',
});

Low-Level API

For more fine-grained control, use the Low-Level API:

typescript
import { APIClient } from 'novelai-sdk-unofficial/api';

const client = new APIClient({ apiKey: 'your-api-key' });

// Augment image
const images = await client.image.augmentImage({
  image: base64String,
  req_type: 'bg-removal',
  width: 1024,
  height: 1024,
});

// Suggest tags
const response = await client.image.suggestTags(
  'nai-diffusion-4-5-full',
  '1girl, blue',
  'en'
);

Released under the MIT License.