A command-line interface for interacting with various Large Language Models (LLMs) with built-in tool support for development tasks.
#LLM #DeepSeek #Ollama #ChatGPT #CLI #Tools
LLM-CLI is a TypeScript-based command-line interface that allows you to interact with multiple LLM providers (DeepSeek, Ollama, ChatGPT) through a unified interface. The tool features built-in capabilities for file management, workspace operations, and development tasks through an extensible tool system.
- Multi-LLM Support: Switch between DeepSeek, Ollama, and ChatGPT
- Tool Integration: Built-in tools for file operations, npm package management, weather info, and more
- Streaming Responses: Real-time response streaming with reasoning display
- Conversation Management: Maintain conversation context with temperature control
- File Operations: Read, write, edit, and list files in your workspace
- Development Tools: Install npm packages, manage dependencies, and more
- Node.js (v16 or higher)
- npm or yarn
- For Ollama: Ollama installed and running locally
- Clone the repository:
git clone <repository-url>
cd llm-cli- Install dependencies:
npm install-
Configure API keys (optional):
- For DeepSeek: Set
DEEPSEEK_API_KEYenvironment variable - For ChatGPT: Set
OPENAI_API_KEYenvironment variable - For Ollama: Ensure Ollama is running (default: http://localhost:11434)
- For DeepSeek: Set
-
Start the CLI:
npm startTo install the CLI globally on your system (so you can run llm-cli from anywhere):
- Install the package globally from the local directory:
npm install -g .-
Configure API keys (same as above).
-
Run the CLI:
llm-cliOnce started, you'll see a banner with LLM configuration. Type your questions or commands:
LLM> What's the weather in Tokyo tomorrow?
Use slash commands for system operations:
/helpor/h- Show help/exit,/quit,/q, or/x- Exit the program/clearor/c- Clear conversation history/temp <value>or/t <value>- Set temperature (0.0 to 1.0)/debugor/d- Enable debug mode
The LLM has access to the following tools for assisting with development tasks:
list_workspace- List files on the user workspaceget_file- Read the contents of a single fileget_files- Read multiple files using glob patternsnew_file- Create or overwrite a fileedit_file- Edit an existing file with new content
npm_install- Install npm packages (specific packages or all dependencies)- Parameters:
packages(array): Package names to install (optional)dev(boolean): Install as dev dependency (default: false)global(boolean): Install globally (default: false)
- Parameters:
get_date- Get current date (YYYY-MM-DD)get_weather- Get weather information for a location and date
LLM> Show me the contents of src/tools.ts
[Tool Called: get_file({"file_name":"src/tools.ts"})]
... file contents displayed ...
LLM> Create a new file called test.js with console.log("Hello World")
[Tool Called: new_file({"file_name":"test.js","content":"console.log(\"Hello World\")"})]
FILE WRITTEN
LLM> Edit test.js to add a function
[Tool Called: edit_file({"file_name":"test.js","content":"function greet() {\\n console.log(\"Hello World\");\\n}\\n\\ngreet();"})]
FILE_EDITED_SUCCESSFULLY
LLM> Install express and cors as dependencies
[Tool Called: npm_install({"packages":["express","cors"]})]
Successfully installed packages: express, cors
LLM> Install jest as a dev dependency
[Tool Called: npm_install({"packages":["jest"],"dev":true})]
Successfully installed packages: jest
LLM> Install all dependencies from package.json
[Tool Called: npm_install({})]
Successfully installed all dependencies from package.json
LLM> List all TypeScript files in the project
[Tool Called: get_files({"glob_pattern":"**/*.ts"})]
... files displayed ...
LLM> What's the current date?
[Tool Called: get_date({})]
2024-01-15
The CLI automatically selects the LLM based on available API keys:
- DeepSeek (if
DEEPSEEK_API_KEYis set) - ChatGPT (if
OPENAI_API_KEYis set) - Ollama (default, requires Ollama running locally)
DEEPSEEK_API_KEY: Your DeepSeek API keyOPENAI_API_KEY: Your OpenAI API keyOLLAMA_HOST: Custom Ollama host URL (default: http://localhost:11434)
- Model: DeepSeek uses
deepseek-reasoner, Ollama usesllama3.2 - Temperature: 0.1 (adjustable with
/tempcommand) - Max Tokens: 65536
llm-cli/
├── src/
│ ├── api.ts # LLM API communication
│ ├── cli.ts # Command-line interface
│ ├── index.ts # Main entry point
│ ├── tools.ts # Tool registry and interface
│ └── tools/ # Individual tool implementations
│ ├── workspace.ts # List workspace files
│ ├── getFile.ts # Read single file
│ ├── getFiles.ts # Read multiple files
│ ├── newFile.ts # Create files
│ ├── editFile.ts # Edit files
│ ├── npmInstall.ts # Install npm packages
│ ├── getDate.ts # Get current date
│ └── getWeather.ts # Get weather info
├── bin/
│ └── llm-cli.js # Global CLI entry point
├── package.json
└── README.md
To add a new tool:
- Create a new file in
src/tools/implementing theToolInterface - Import and register the tool in
src/tools.ts - Update the README with tool documentation
The project uses TypeScript with tsx for execution. No separate build step is required for development.
[Add appropriate license information here]
[Add contribution guidelines here]
- Built with TypeScript and Node.js
- Uses Axios for HTTP requests
- Supports DeepSeek, Ollama, and ChatGPT APIs
- Inspired by various CLI tools and AI assistants