simple-ai-chat
v0.1.51
Published
AI chat application based on large language models (LLMs), supports web and command-line interfaces. Available at `simple-ai.io`.
Readme
Simple AI
Simple AI (simple-ai-chat) is a command-based AI chat application that supports both the web and CLI, aimed at providing users with an easy and simple AI experience.
It can use advanced large language models (LLMs) from multiple companies: OpenAI, xAI, Google AI, Anthropic, and Ollama models.
Text generation, image generation, and vision models are supported. Features like function calling and the Model Control Protocol (MCP) are also supported.
The application is deployed at simple-ai.io.
You can fork this code and deploy it on your own machine for non-commercial use. (For details, please refer to the LICENSE file.) For bugs or suggestions, please report them to the repository's GitHub Issues page.
Quick Start
Web use
https://simple-ai.ioCommand-line interface (CLI) use
Install:npm i simple-ai-chat -g
Start:schatorsc
Start CLI will also start the MCP client.
npm package:simple-ai-chatMCP client
Install:npm i simple-ai-chat -g
Usesmcpto start the client service.
Themcpconfig.jsonfile is located in the~/.simplefolder.Ollama
Set the environment variableOLLAMA_ORIGINSto*or your domain to allow CORS.
Start the Ollama server withollama serve.export OLLAMA_ORIGINS="*" ollama serveNote: to use function calling, set
:stream offas in Ollama it's not supported.
Documentation
The documentation is available at simple-ai.io.
In the webpage, there is a little dot on the bottom right corner, click it to open the back page.
Alternatively, you can use the command :store use "Simple AI Documentation" to enable the data to AI, and ask it.
Dependencies
OpenAI https://platform.openai.com/docs/api-reference
React https://reactjs.org/
Next.js https://nextjs.org/
tailwind https://tailwindcss.com/docs/
Anthropic https://www.anthropic.com/
Google AI https://ai.google.dev/gemini-api/docs
xAI https://x.ai/
Ollama https://ollama.com/
WolframAlpha APIs https://products.wolframalpha.com/api
CLI Interface
cli.js is for the command-line interface.
- Setup with npm package
Instll from npm packagenpm i simple-ai-chat -g
Start the CLI with npm package command
sc or schat
Check versionsc [-v|--version]
Updatenpm update simple-ai-chat -g
Note: Start the CLI interface will also start the MCP client.
- CLI commands
Use the VI as editor for input:vi
Exit:exit
- Development
Start the CLInode cli.js
Debugsc [-d|--debug]
Change server base URL
By default the CLI will communicate with simple-ai.io server.
To change the server base URL use the command:
sc [-b|--base-url <base_url>]
MCP Client
mcp.js is for the MCP client.
Start the MCP clientnode mcp.js
Configure the MCP client
Use mcpconfig.json located in the ~/.simple folder to setup the MCP connection.
npm package start
After installing the npm package, start with the commandsmcp
Work with Docker MCP Tookit
Install Docker and setup the MCP Tookit.
Use mcpconfig.json.docker.example to connect.
Local Installation
Prerequisites
OpenAI API key (get from https://platform.openai.com/account/api-keys)Install the requirements.
npm installCreate
.envand setup it.
Create.envfrom.env.example
For setup refer to the.envsection below.Run
setup.shto initialize.bash setup.shBuild and run the app.
npm run build
Then usenpm run devornpm start
.env Setup
Copy .env.example to .env and fill in the values.
NODE_ENV
For development environment use development.
For production environment use production.
NEXT_PUBLIC_BASE_URL
Fill in the base URL, for example: http://localhost:3000
ROOT_PASS
System root password, will be set when database initialized.
OPENAI_BASE_URL and OPENAI_API_KEY
Key can get from https://platform.openai.com/account/api-keys
Base URL is the API endpoint, https://api.openai.com/v1, etc...
MODEL
Large language model, gpt-4o, etc...
TEMPERATURE
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random
lower values like 0.2 will make it more focused and deterministic.
TOP_P
Range 0 ~ 1, 0.1 means only the tokens comprising the top 10% probability mass are considered.
ROLE_CONTENT_SYSTEM
Set the system prompt.
WELCOME_MESSAGE Control the custom welcome message.
WOLFRAM_ALPHA_APPID
For API calls for wolfram alpha API.
Get from https://products.wolframalpha.com/api
USE_NODE_AI
Simple AI Node is available to help the chat answer with data.
To use multiple nodes, consider using Simple AI Hub.
DB
Database engline, example DB=sqlite.
Supported engine: sqlite.
JWT_SECRET
Secret for user authentication.
Generate with openssl rand -hex 16.
AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_S3_BUCKET_NAME
Config to use AWS service, eg, S3 Bucket, SES.
USE_ACCESS_CONTROL
When it enabled, will count user usage and limit access for normal user.
The value should be true or false.
USE_PAYMENT
Enable payment.
The value should be true or false.
PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET
When using paypal as a payment method.
SAME_SITE_COOKIE
In production set to SameSite=Lax; Secure
USE_EMAIL
Use email to reset password or notifications.
The value should be true or false.
NEXT_PUBLIC_ROLE_USAGE_LIMIT and NEXT_PUBLIC_ROLE_AMOUNT
Usage limit is for setting limit for different roles.
Format: role:daily_limit,weekly_limit,monthly_limit.
Role amount is for setting price.
Format role:amount.
Roles are separated by ;.
HUNTER_API_KEY
Use hunter API to verify email.
GOOGLE_API_KEY
Use for detect accurate address.
MINIMALIST
For minimalist, a more simple UI.
The value should be true or false.
IPINFO_TOKEN
IP info (ipinfo.io) is used for getting country from IP.
Use IP info is for enable or disable the IP support, the value should be true or false.ipinfo.io token will be used.
USE_USER_ACCOUNTS
Enable user accounts, the value should be true or false.
DEFAULT_FUNCTIONS, DEFAULT_ROLE, DEFAULT_STORES, DEFAULT_NODE
Default functions, role, stores and node.
Example:
DEFAULT_FUNCTIONS=get_time,get_weather,redirect_to_url
DEFAULT_STORES=store1,store2
Originally Forked from https://github.com/openai
