New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

liblibai-js-example

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liblibai-js-example

Simple JavaScript example of using LiblibAI SDK for image generation

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

LiblibAI SDK - Simple JavaScript Example

This example demonstrates how to use the LiblibAI SDK in a JavaScript project to generate images from text prompts.

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Setup

  • Create a .env file in this directory with your LiblibAI API credentials:
LIBLIBAI_API_KEY=your_api_key
LIBLIBAI_API_SECRET=your_api_secret
  • Install dependencies:
npm install
# or
yarn install

Running the Example

npm start
# or
yarn start

This will:

  • Connect to the LiblibAI API using your credentials
  • Generate an image based on the prompt "A beautiful sunset over mountains"
  • Display the image URLs in the console

Customizing the Example

You can modify the index.js file to:

  • Change the prompt
  • Adjust image dimensions
  • Set different generation parameters
  • Add more advanced features like image-to-image generation

Learn More

For more information, check out the LiblibAI SDK documentation.

FAQs

Package last updated on 21 Mar 2025

Related posts