novelai-sdk-unofficial / NovelAI
Class: NovelAI
Defined in: src/client.ts:695
High-level NovelAI client
Provides a user-friendly interface for interacting with the NovelAI API. Includes automatic parameter validation, quality tags, and sensible defaults.
Example
// Initialize with API key
const client = new NovelAI({ apiKey: 'your-api-key' });
// Or use environment variable NOVELAI_API_KEY
const client = new NovelAI();
// Generate images
const images = await client.image.generate({
prompt: 'a beautiful landscape',
model: 'nai-diffusion-4-5-full',
size: 'landscape',
});Constructors
Constructor
new NovelAI(
options):NovelAI
Defined in: src/client.ts:713
Create a new NovelAI client instance
Parameters
options
NovelAIOptions = {}
Client configuration options
Returns
NovelAI
Throws
MissingAPIKeyError if API key is not provided and not found in environment
Properties
image
readonlyimage:ImageGeneration
Defined in: src/client.ts:699
High-level image generation interface
openai
readonlyopenai:OpenAIGeneration
Defined in: src/client.ts:705
High-level OpenAI-compatible generation interface
text
readonlytext:TextGeneration
Defined in: src/client.ts:702
High-level text generation interface
Accessors
apiClient
Get Signature
get apiClient():
APIClient
Defined in: src/client.ts:759
Get the underlying low-level API client
Use this when you need direct access to the REST API without automatic parameter processing.
Returns
APIClient
apiKey
Get Signature
get apiKey():
string
Defined in: src/client.ts:742
Get the API key
Returns
string
timeout
Get Signature
get timeout():
number
Defined in: src/client.ts:749
Get the request timeout in milliseconds
Returns
number