Skip to content

Add shell auto-completion support for OpenAI CLI (bash, zsh, fish, powershell) #2545

@LuminaX-alt

Description

@LuminaX-alt

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • This is a feature request for the Python library

Describe the feature or improvement you're requesting

Feature Request: Shell Auto-Completion for OpenAI CLI

Description
Currently, the OpenAI CLI does not provide shell auto-completion for commands and options.
Adding support for shell auto-completion will improve developer productivity and reduce the need to repeatedly check documentation.

Proposed Solution

  • Implement CLI auto-completion scripts for major shells:
    • Bash
    • Zsh
    • Fish
    • PowerShell
  • Detect the shell environment automatically or allow the user to specify it.
  • Provide instructions in the README or CLI help on how to enable completion.

Example
openai <TAB> → should list all available commands
openai api <TAB> → should list relevant subcommands and options

Benefits

  • Faster CLI usage
  • Fewer syntax errors
  • Improved user experience for developers working frequently with the CLI

Additional Context
This feature is common in modern CLI tools (e.g., kubectl, git, aws-cli) and is relatively straightforward to implement using libraries like click or argcomplete.

Environment

  • openai-python version: Latest (as of issue date)
  • OS: All major platforms
  • Shells: bash, zsh, fish, powershell

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions