A NodeJS GPT-4 CLI client
npm install node-gpt-cliA NodeJS GPT-4 CLI client for generating completions from OpenAI or DeepInfra.
``bash`
npm install
The following npm scripts are available:
- 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
- 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
- npm run postinstall - Run after installation to set up configurationnpm run uninstall
- - Remove configuration files
`bashUsing npm start
npm start "Your prompt here"
Configuration
Configuration is stored in
~/.node-gpt-config.json and includes settings for the API endpoint, model, and other parameters.$3
The CLI supports both OpenAI and DeepInfra APIs. API configuration is managed through the configuration file:
1. OpenAI API
- Set your OpenAI API key in the configuration file
- Default configuration uses OpenAI's API endpoint
2. 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:
`json
{
"apiKey": "your-openai-api-key",
"deepInfraApiKey": "your-deepinfra-api-key",
"model": "gpt-4",
"temperature": 0.7,
"maxTokens": 2000
}
``MIT