@milcondev/free-ai

6.0.0 • Public • Published

FREE AI

NPM info

The Free AI is an npm package designed to help developers interact with the powerful AI-based image generation and question-answering functionalities provided by free-ai.xyz. This API is perfect for creating dynamic AI-driven content for websites, apps, or bots.

Get Started

To get started, install the package and obtain your API key from the dashboard.

Get your API Key

  1. Visit free-ai.xyz/dashboard to create an account or log in.
  2. Once logged in, click the generate API Key button to generate your API key.
  3. Use the provided API key in your application.

Installation

npm install @milcondev/free-ai

Features

  • AI Image Generation: Create stunning AI-generated images with custom prompts.
  • AI Question & Chat Handling: Submit questions or chat content and receive AI-generated responses.
  • Moderation Filter: Check content for appropriateness using the moderation filter API.
  • Changeable AI Models: Users can specify which AI model to use based on their needs.
  • Free AI Basic Model: A simplified AI chat model for basic AI-generated responses.
  • Easy Integration: Simple, lightweight, and well-documented API.

Usage

const FreeAI = require('@milcondev/free-ai');
const freeAI = new FreeAI('your-api-key');

// Example of generating an image (model is optional and defaults to 'v3')
freeAI.generateImage('Prompt', 'v3')
    .then(imageUrl => console.log('Generated Image URL:', imageUrl))
    .catch(error => console.error('Error:', error.message));


// Example of asking a question (model is optional and defaults to 'v3')
freeAI.askQuestion('What is the population of Earth?')
    .then(response => console.log('Question Response:', response))
    .catch(error => console.error('Error:', error.message));

// Example of using the Free AI Basic model for a simple response
freeAI.basicAiResponse('Hello, how are you?')
    .then(response => console.log('Basic AI Response:', response))
    .catch(error => console.error('Error:', error.message));

// Example of checking content with the moderation filter
freeAI.checkContent('Some inappropriate content')
    .then(response => console.log('Moderation Response:', response))
    .catch(error => console.error('Error:', error.message));

API Reference

generateImage(prompt, model = 'v3', negativePrompt = '')

  • Description: Generates an AI-generated image based on the provided prompt and model.
  • Parameters:
    • prompt (string): The text prompt for image generation.
    • model (string, optional): The model to use for generation (default is 'v3').
    • negativePrompt (string, optional): A prompt to specify what should be avoided in the image.

askQuestion(content, model = 'v3')

  • Description: Submits a question or chat content and receives a response from the AI.
  • Parameters:
    • content (string): The question or chat content.
    • model (string, optional): The model to use for generating the response (default is 'v3').

checkContent(content)

  • Description: Checks the provided content for appropriateness using the moderation filter.
  • Parameters:
    • content (string): The content to be checked.

basicAiResponse(message)

  • Description: Provides a simple AI-generated response using the Free AI Basic model.
  • Parameters:
    • message (string): The message or prompt for generating the response.

License

This project is licensed under the MIT License

Package Sidebar

Install

npm i @milcondev/free-ai

Weekly Downloads

9

Version

6.0.0

License

MIT

Unpacked Size

7.91 kB

Total Files

3

Last publish

Collaborators

  • milcondev