UNPKG

node-gpt-cli

Version:

A NodeJS GPT-4 CLI client

78 lines (52 loc) 1.88 kB
# Node GPT CLI A NodeJS GPT-4 CLI client for generating completions from OpenAI or DeepInfra. ## Installation ```bash npm install ``` ## Available Scripts The following npm scripts are available: ### Development - `npm start` - Run the application using gpt.js - `npm run dev` - Run the application with trace warnings - `npm run dev:debug` - Run the application with the debugger ### Formatting and Linting - `npm run format` - Format all files with Prettier - `npm run format:check` - Check formatting without changing files - `npm run setup:prettier` - Set up Prettier for the project - `npm run lint` - Lint JavaScript files with ESLint ### Configuration - `npm run postinstall` - Run after installation to set up configuration - `npm run uninstall` - Remove configuration files ## Usage ```bash # 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: 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 } ``` ## License MIT