@jbaldwin/craiyon
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

node-craiyon

Unofficial Node.js API client for Craiyon (formerly DALL-E Mini).

Getting Started

Install the module using npm:

npm install craiyon

or Yarn:

yarn add craiyon

Basic Usage

const { Client } = require('craiyon');

const craiyon = new Client();
const result = await craiyon.generate({
  prompt: 'Painting of a dachshund drinking water in the style of Van Gogh',
});

You can then use any of the methods available in result to get the generated images in any way you want.

You can learn more about the supported methods in the documentation.

Customization

By default, the library will retry a request 3 times if something goes wrong. You may change this behavior either by instantiating the client with a custom number of maximum retries (for all generations):

const craiyon = new Client().withMaxRetries(5);

or by setting a custom number of retries for a specific generation:

const result = await craiyon.generate({
  prompt: 'Painting of a dachshund drinking water in the style of Van Gogh',
  maxRetries: 5,
});

Notice

Please note that this is using a reverse-engineered backend endpoint provided by Craiyon. The endpoint could, at any point in time, change the request and/or response, or become unavailable for public use altogether. If you encounter any problems with the library, please open an issue on GitHub.

For Contributors

node-craiyon is written in TypeScript, therefore, you have to compile it to JavaScript if you'd like to test your changes. You may do so using the following command:

npm run build

The library does not currently employ any unit testing measures, however, if you would like to contribute to the library, please make sure that your changes pass linting. You can run the following command to check:

npm run lint

License

MIT. Please read the LICENSE file for more information.

Package Sidebar

Install

npm i @jbaldwin/craiyon

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

33.7 kB

Total Files

17

Last publish

Collaborators

  • jbaldwin