Openai api cmd line call returns "Error: No such command 'api'."


I’m using both Win11 and WSL Ubuntu, read all related posts on the forum, and still have the same problem with calling:

:>>> openai api fine_tunes.create -t “c:/repos/AI/test_story_1/my_file.jsonl” --batch_size 16
Usage: openai [OPTIONS] COMMAND [ARGS]…
Try ‘openai --help’ for help.

Error: No such command ‘api’.

I have the API key registered in env var, budget is OK and available, I updated PATH with python installation path, its Scripts subfolder, or wherever ‘openai’ was installed.

All seems to be in place, but it simply does not work. ‘api’ and ‘tools’ commands are not available, just ‘complete’ and ‘repl’.

Did I install some incorrect package, how should this be debugged?

Thank you so much.

1 Like

How did you install the CLI?

pip install --upgrade openai ?

What’s the output of openai --help

Should be:

usage: openai [-h] [-V] [-v] [-b API_BASE] [-k API_KEY] [-o ORGANIZATION] {api,tools,wandb} ...

positional arguments:
    api                 Direct API calls
    tools               Client side tools for convenience
    wandb               Logging with Weights & Biases

Sounds like you may have installed this instead

1 Like

I installed both ‘openai’ and ‘openai-cli’.

Output is as follows, this is the problem, no ‘api’ or ‘tools’:
:> openai --help
Usage: openai [OPTIONS] COMMAND [ARGS]…

–help Show this message and exit.

complete Return OpenAI completion for a prompt from SOURCE.
repl Start interactive shell session for OpenAI completion API.

Should I uninstall ‘openai-cli’?

Probably, unless you need it for something.

1 Like

I uninstalled all openai related and installed back, it works!

Thank you! :slight_smile: