node-gpt-cli
v3.0.0
Published
A NodeJS GPT-4 CLI client
Readme
Node GPT CLI
A NodeJS GPT-4 CLI client for generating completions from OpenAI or DeepInfra.
Installation
npm installAvailable Scripts
The following npm scripts are available:
Development
npm start- Run the application using gpt.jsnpm run dev- Run the application with trace warningsnpm run dev:debug- Run the application with the debugger
Formatting and Linting
npm run format- Format all files with Prettiernpm run format:check- Check formatting without changing filesnpm run setup:prettier- Set up Prettier for the projectnpm run lint- Lint JavaScript files with ESLint
Configuration
npm run postinstall- Run after installation to set up configurationnpm run uninstall- Remove configuration files
Usage
# Using npm start
npm start "Your prompt here"
# Using the CLI directly
./index.js "Your prompt here"
# Using the binary (if globally installed)
gpt4 "Your prompt here"Configuration
Configuration is stored in ~/.node-gpt-config.json and includes settings for the API endpoint, model, and other parameters.
API Options
The CLI supports both OpenAI and DeepInfra APIs. API configuration is managed through the configuration file:
OpenAI API
- Set your OpenAI API key in the configuration file
- Default configuration uses OpenAI's API endpoint
DeepInfra API
- Set your DeepInfra API key in the configuration file
- The CLI will automatically use DeepInfra's API endpoint when configured
The CLI will prioritize DeepInfra if both APIs are configured. If neither is configured, it will use the default OpenAI settings.
Example configuration file:
{
"apiKey": "your-openai-api-key",
"deepInfraApiKey": "your-deepinfra-api-key",
"model": "gpt-4",
"temperature": 0.7,
"maxTokens": 2000
}License
MIT
