openai-cli

Interacts with the OpenAI REST API from the command line for chat, embeddings, and fine-tuning.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/reason-machines/devtools-skills --skill openai-cli-reason-machines
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: openai-cli
Source: https://github.com/reason-machines/devtools-skills/tree/main/skills/openai-cli
Command: npx skills add https://github.com/reason-machines/devtools-skills --skill openai-cli-reason-machines

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often need to test OpenAI API endpoints, run quick completions, upload fine-tuning files, or check usage without writing a full script. This Skill provides command-line access to the OpenAI REST API so these tasks can be done directly from a terminal or shell pipeline. ## Core Features & Use Cases - Chat Completions & Responses: Create and stream chat completions with model, system message, and temperature flags. - File & Fine-Tuning Operations: Upload training files, create and monitor fine-tuning jobs, and manage stored files. - Embeddings & Admin: Generate text embeddings and query organization usage statistics via admin endpoints. - Output Control: Format results as JSON, JSONL, YAML, or pretty text, and extract fields with GJSON transforms. - Use Case: A developer batch-processes prompts from a text file, piping each line into openai responses create and appending JSON results to a results.jsonl file for later analysis. ## Quick Start Use the OpenAI CLI to create a chat completion with the prompt "Explain quantum computing in simple terms" using the gpt-4 model.

Frequently Asked Questions about openai-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call the OpenAI API from the command line?▼

Install the OpenAI CLI via Homebrew or Go, set the OPENAI_API_KEY environment variable, then run commands like openai responses create --input "Hello" --model gpt-4. Output can be formatted as JSON, YAML, or pretty text.

How to create a fine-tuning job with the OpenAI CLI?▼

First upload a JSONL training file with openai files create --file @training_data.jsonl --purpose fine-tune, then run openai fine-tuning jobs create --training-file <file-id> --model gpt-3.5-turbo. Monitor progress with openai fine-tuning jobs retrieve.

Does the OpenAI CLI support custom base URLs like Azure?▼

Yes, pass the --base-url flag to point the CLI at Azure OpenAI or other compatible endpoints, for example openai --base-url https://custom.openai.azure.com/v1 responses create --input "Hello" --model gpt-4.

Why does the OpenAI CLI return authentication errors?▼

Authentication errors occur when OPENAI_API_KEY is unset or invalid. Verify it with echo $OPENAI_API_KEY, and use OPENAI_ADMIN_KEY separately for admin endpoints such as organization usage statistics.

How do I pass files as arguments to the OpenAI CLI?▼

Prefix file paths with @, such as --file @data.jsonl or --arg @image.jpg. Use @file:// for explicit string encoding, @data:// for base64 encoding, and escape a literal @ character with a backslash.