FlexiAI is a flexible AI solution that provides a unified interface for multiple AI providers.
- Multiple AI provider support (OpenAI, Anthropic, Claude, Gemini, Deepseek, Grok, Perplexity, Groq, AssemblyAI, ElevenLabs, and Qwen)
- RESTful API with Swagger documentation
- Built with TypeScript for type safety
- Fast and efficient with Bun runtime
- Comprehensive validation using Zod
- Modern development setup with ESLint and Prettier
- Node.js >= 18.0.0
- Bun runtime
- Clone the repository
git clone https://github.com/Flexi-ai/flexi.git
cd FlexiAI- Install dependencies
bun install- Set up environment variables
cp .env.example .envEdit the .env file and add your API keys for the AI providers you want to use.
The following environment variables can be configured in your .env file:
| Variable | Description | Default Value | Available Options | Supported Types |
|---|---|---|---|---|
PORT |
The port number for the server | 3000 | Any valid port number | - |
API_USERNAME |
Username for API authentication | admin | Any string | - |
API_PASSWORD |
Password for API authentication | secret123 | Any string | - |
LOG_LEVEL |
Controls the verbosity of logging | info | error, warn, info, debug, verbose | - |
LOGGING_ENABLED |
Enable/disable request/response logging | true | true, false | - |
OPENAI_API_KEY |
Your OpenAI API key | - | Valid API key | text, audio |
ANTHROPIC_API_KEY |
Your Anthropic API key | - | Valid API key | text |
GEMINI_API_KEY |
Your Google Gemini API key | - | Valid API key | text, audio |
DEEPSEEK_API_KEY |
Your Deepseek API key | - | Valid API key | text |
GROK_API_KEY |
Your Grok API key | - | Valid API key | text |
PERPLEXITY_API_KEY |
Your Perplexity API key | - | Valid API key | text |
GROQ_API_KEY |
Your Groq API key | - | Valid API key | text, audio |
ASSEMBLYAI_API_KEY |
Your AssemblyAI API key | - | Valid API key | audio |
ELEVENLABS_API_KEY |
Your ElevenLabs API key | - | Valid API key | audio |
QWEN_API_KEY |
Your Qwen API key | - | Valid API key | text |
To start the development server with hot reload:
bun run devbun run typecheck: Run TypeScript type checkingbun run test: Run testsbun run test:watch: Run tests in watch modebun run test:coverage: Run tests with coverage reportbun run format: Format code with Prettierbun run lint: Lint and fix code with ESLint
- Install dependencies:
bun install --production- Run type checking and tests:
bun run check:all- Set up environment variables:
cp .env.example .envEdit .env with your production values.
- Start the production server:
bun run start- Build the Docker image:
FROM oven/bun:latest
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --production
COPY . .
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["bun", "run", "start"]- Build and run the container:
docker build -t flexiai .
# Create a directory for logs on the host machine
mkdir -p ./logs
# Run the container with a mounted volume for logs
docker run -p 3000:3000 --env-file .env \
-v "$(pwd)/logs:/app/logs" \
flexiaiNote: The
-v "$(pwd)/logs:/app/logs"option creates a shared volume that maps thelogsdirectory from your host machine to the/app/logsdirectory inside the container. This ensures that logs are persisted even if the container is removed or recreated.
-
Environment Variables:
- Ensure all required environment variables are properly set
- Use appropriate API keys for production
- Set
LOG_LEVEL=errorfor production - Consider using a secrets management service
-
Security:
- Change default
API_USERNAMEandAPI_PASSWORD - Enable HTTPS in production
- Set up appropriate CORS policies
- Consider using a reverse proxy (e.g., Nginx)
- Change default
Once the server is running, you can access the Swagger UI documentation at:
http://localhost:3000/swagger
Detailed API documentation is available in the docs folder:
- Provider API Documentation - Endpoints for managing and interacting with AI providers
- Text Completion API Documentation - Endpoints for text completion and chat functionality
- Audio Transcription API Documentation - Endpoints for audio transcription functionality
We welcome contributions! Please see our Contributing Guide for details on how to submit pull requests, report issues, and contribute to the project.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
This project is licensed under the MIT License - see the LICENSE file for details.