npm package: @milcondev/free-ai
Description: This will allow users of your npm package to generate images or ask questions through the `FreeAI` class, keeping both functionalities in one package.
Author: Milcondev
Latest version: 6.0.0


<h1 align="center">FREE AI</h1>

<p align="center">
 <a href="https://nodei.co/npm/@milcondev/free-ai/"><img src="https://nodei.co/npm/@milcondev/free-ai.png?downloads=true&stars=true" alt="NPM info" /></a>
</p>

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](https://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](https://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

```bash
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

```javascript
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