https://github.com/hn12404988/gpt-files
Cross-Platform CLI tool for managing resources for OpenAI assistant
https://github.com/hn12404988/gpt-files
assistant assistant-api chatgpt cli file-search openai openai-api
Last synced: 3 months ago
JSON representation
Cross-Platform CLI tool for managing resources for OpenAI assistant
- Host: GitHub
- URL: https://github.com/hn12404988/gpt-files
- Owner: hn12404988
- Created: 2024-12-29T10:17:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-22T07:01:38.000Z (over 1 year ago)
- Last Synced: 2025-07-24T02:28:52.022Z (11 months ago)
- Topics: assistant, assistant-api, chatgpt, cli, file-search, openai, openai-api
- Language: TypeScript
- Homepage:
- Size: 66.4 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gpt-files
## Description
`gpt-files` is a CLI tool for managing resources (`file`, `vector store`,
`code`...etc) for OpenAI assistant with ease. It can be easily installed on
Linux, macOS, and Windows.
## Installation
#### For Linux and macOS
```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hn12404988/gpt-files/main/install.sh)"
```
#### For Windows (PowerShell)
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/hn12404988/gpt-files/main/install.ps1 | Invoke-Expression"
```
## Features
```sh
# Create a new assistant
gpt-files create-assistant -n my-assistant
# Upload a file to the assistant
gpt-files upload ./deno.json
# Upload all files of a directory to the assistant
gpt-files upload-dir ./reports
# List all files in the assistant
gpt-files list
```
## All Commands
To see all the available commands and options, please run `--help`.
```sh
$ gpt-files --help
```
```sh
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
--verbose - Print verbose output (Default: false)
Commands:
# Assistant
create-assistant - Create a new assistant.
update-assistant - Update an assistant
del-assistant - Delete an assistant
assistant - Show the details of an assistant
assistants - List all assistants
# Vector Store
create-store - Create a new vector store
del-store - Delete a vector store
store - Show the details of a vector store
stores - List all vector stores
# File
upload - Upload a file to an assistant
upload-dir - Upload all files of a directory to an assistant
delete - Detach a file from an assistant and delete it permanently
detach - Detach a file from an assistant
file - Show the details of a file
list - List all files attached to an assistant
files - List all files under your openai account
Environment variables:
OPENAI_API_KEY - OpenAI api key (required)
OPENAI_ASSISTANT_ID - OpenAI assistant id. Required for file operation commands
```
For each command, you can run `--help` to see the available options like this.
```sh
$ gpt-files upload --help
```
```sh
Usage: gpt-files upload
Description:
Upload a file to an assistant
Options:
-h, --help - Show this help.
--verbose - Print verbose output (Default: false)
-n, --file-name - New filename to replace the original filename
-o, --overwrite - Overwrite if existed (Default: false)
-d, --destination - Upload to vector store or code interpreter. (Default: "file", Values: "file", "code")
-a, --assistant-id - If this option is provided, this is used as the assistant id instead of the OPENAI_ASSISTANT_ID environment variable
Environment variables:
OPENAI_API_KEY - OpenAI api key (required)
OPENAI_ASSISTANT_ID - OpenAI assistant id. Required for file operation commands
Examples:
Upload to code interpreter: gpt-files upload --destination=code ./main.ts
gpt-files upload -d code ./main.ts
New file name: gpt-files upload --file-name=report.txt ./report_2024-01.txt
gpt-files upload -n report.txt ./report_2024-01.txt
Overwrite existed: gpt-files upload --overwrite --file-name=report.txt ./report_2024-02.txt
gpt-files upload -o -n report.txt ./report_2024-02.txt
```