liblibai-js-example
v1.0.0
Published
Simple JavaScript example of using LiblibAI SDK for image generation
Downloads
5
Readme
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
.envfile 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 installRunning the Example
npm start
# or
yarn startThis 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.
