Skip to content

An OpenAI CLI for managing resources

License

Notifications You must be signed in to change notification settings

devlooped/dotnet-openai

Repository files navigation

Icon OpenAI CLI

Version Downloads License Build

Usage

> openai --help
USAGE:
    openai [OPTIONS] <COMMAND>

EXAMPLES:
    openai file list --jq '.[].id'
    openai file list --jq ".[] | { id: .id, name: .filename, purpose: .purpose 
}"
    openai file list --jq ".[] | select(.sizeInBytes > 100000) | .id"
    openai vector create --name my-store --meta 'key1=value1' --meta 
'key2=value'
    openai vector create --name with-files --file asdf123 --file qwer456

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    auth       
    file       
    vector     
    model      

Authentication

Authentication is managed for you by the CLI, using the Git Credential Manager as the cross-platform secure storage for your API key(s). You can login multiple project/key combination and then just change the active one without ever re-entering the keys.

See authentication for more details.

> openai auth --help
USAGE:
    openai auth [OPTIONS] <COMMAND>

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    login <project>    Authenticate to OpenAI.                                  
                                                                                
                       Supports API key autentication using the Git Credential  
                       Manager for storage.                                     
                                                                                
                       Switch easily between keys by just specifying the project
                       name after initial login with `--with-token`.            
                                                                                
                       Alternatively, openai will use the authentication token  
                       found in environment variables with the name             
                       `OPENAI_API_KEY`.                                        
                       This method is most suitable for "headless" use such as  
                       in automation.                                           
                                                                                
                       For example, to use openai in GitHub Actions, add        
                       `OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}` to "env" 
    logout             Log out of api.openai.com                                
    status                                                                      
    token              Print the auth token openai is configured to use         
> openai auth login --help
DESCRIPTION:
Authenticate to OpenAI. 

Supports API key autentication using the Git Credential Manager for storage.

Switch easily between keys by just specifying the project name after initial 
login with `--with-token`.

Alternatively, openai will use the authentication token found in environment 
variables with the name `OPENAI_API_KEY`.
This method is most suitable for "headless" use such as in automation.

For example, to use openai in GitHub Actions, add `OPENAI_API_KEY: ${{ 
secrets.OPENAI_API_KEY }}` to "env".

USAGE:
    openai auth login <project> [OPTIONS]

ARGUMENTS:
    <project>    OpenAI project the API key belongs to

OPTIONS:
    -h, --help          Prints help information       
        --with-token    Read token from standard input
> openai auth logout --help
DESCRIPTION:
Log out of api.openai.com

USAGE:
    openai auth logout [OPTIONS]

OPTIONS:
    -h, --help    Prints help information
> openai auth status --help
USAGE:
    openai auth status [OPTIONS]

OPTIONS:
    -h, --help          Prints help information
        --show-token    Display the auth token 

Files

Implements the Files API.

> openai file --help
USAGE:
    openai file [OPTIONS] <COMMAND>

EXAMPLES:
    openai file list --jq '.[].id'
    openai file list --jq ".[] | { id: .id, name: .filename, purpose: .purpose 
}"
    openai file list --jq ".[] | select(.sizeInBytes > 100000) | .id"

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    upload <FILE>    Upload a local file, specifying its purpose
    delete <ID>      Delete a file by its ID                    
    list             List files                                 
    view <ID>        View a file by its ID                      

Vector Stores

Implements the Vector Stores API.

> openai vector --help
USAGE:
    openai vector [OPTIONS] <COMMAND>

EXAMPLES:
    openai vector create --name my-store --meta 'key1=value1' --meta 
'key2=value'
    openai vector create --name with-files --file asdf123 --file qwer456

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    create         Creates a vector store       
    modify <ID>    Modify a vector store        
    delete <ID>    Delete a vector store by ID  
    list           List vector stores           
    view <ID>      View a store by its ID       
    file           Vector store files operations
> openai vector file --help
DESCRIPTION:
Vector store files operations

USAGE:
    openai vector file [OPTIONS] <COMMAND>

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    add <STORE_ID> <FILE_ID>       Add file to vector store               
    delete <STORE_ID> <FILE_ID>    Remove file from vector store          
    list <STORE_ID>                List files associated with vector store
    view <STORE_ID> <FILE_ID>      View file association to a vector store

Models

List and view available models via the models API;

> openai model --help
USAGE:
    openai model [OPTIONS] <COMMAND>

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    list         List available models
    view <ID>    View model details   

Sponsors

Clarius Org MFB Technologies, Inc. Torutek DRIVE.NET, Inc. Keith Pickford Thomas Bolon Kori Francis Toni Wenzel Uno Platform Dan Siegel Reuben Swartz Jacob Foshee Eric Johnson Ix Technologies B.V. David JENNI Jonathan Charley Wu Jakob Tikjøb Andersen Tino Hager Ken Bonny Simon Cropp agileworks-eu sorahex Zheyu Shen Vezel ChilliCream 4OTC Vincent Limo Jordan S. Jones domischell Joseph Kingry

Sponsor this project  

Learn more about GitHub Sponsors

About

An OpenAI CLI for managing resources

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published