Utilities
Prompt an OpenAI model over a workflow file
OpenAI chat responses from a file and a prompt.
overview
What openai-file does
openai-file is the LLM step in a pipeline: it sends a file and a prompt to an OpenAI chat model and writes the response for the next node.
Model choice is gpt4, 4-32k, chatgpt, or chatgpt-16k. Larger windows fit bigger files at higher cost. The API key arrives as a file input, not on the command line.
Point it at a scan report, findings list, or crawled text when you need summarize, classify, or rewrite before a human or another tool.
source github.com/simonw/llm
use cases
Where openai-file fits
Summarize a scan report
Feed a findings file with a prompt that asks for a short summary, so a long report becomes a few readable lines for the next reviewer.
Classify or triage findings
Pass a list of results and ask the model to group or rank them, turning unsorted output into a prioritized view inside the workflow.
Pick the model for the file size
Choose gpt-4-32k or the 16k turbo variant when the input file is large, or a smaller model when context and cost should stay low.
Rewrite output for a report
Prompt the model to reshape raw tool text into prose for a writeup, keeping the rewrite inside the pipeline rather than a manual step.
reference
openai-file inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| input-file | FILE | · | Input file for the model to read. |
| prompt | STRING | · | Prompt applied to the file input. |
| open-ai-api-key | FILE | · | OpenAI API key, supplied as a file. |
| gpt-4 | BOOLEAN | gpt4 | Use OpenAI Chat gpt-4 (aliases 4, gpt4). |
| gpt-4-32k | BOOLEAN | 4-32k | Use OpenAI Chat gpt-4-32k for larger context. |
| gpt-3-5-turbo | BOOLEAN | chatgpt | Use OpenAI Chat gpt-3.5-turbo (aliases 3.5, chatgpt). |
| gpt-3-5-turbo-16k | BOOLEAN | chatgpt-16k | Use OpenAI Chat gpt-3.5-turbo-16k for a wider context window. |
Showing key inputs. openai-file exposes 7 inputs in total.
example
Run openai-file
# openai-file: summarize hosts.txt with gpt-4# openai-file input=hosts.txt prompt="List live hosts" gpt4Live hosts from the scan:api.example.comapp.example.comstaging.example.comdev.example.commail.example.comvpn.example.com# openai-file summary of 6 hostsguidance
Choosing openai-file
Use openai-file when a workflow needs an LLM to read a file and return text. It calls OpenAI and needs a key plus outbound access. For deterministic transforms without a model, prefer a text or report utility.
json2html
Renders structured data without a model. Prefer it for deterministic transforms.
generate-yaml-report
Builds reports from fixed templates. openai-file uses an LLM for free-form text.
gron
Flattens JSON for grepping. openai-file is generative summarizing, not mechanical reformatting.
faq
openai-file questions
related
More Utilities tools
cewl
Spider a URL and return a wordlist for password crackers.
dnsgen
Wordlist and mined-word subdomain permutation.
pup
CSS selectors over HTML, the jq counterpart for markup.
unfurl
Extract chosen URL parts from stdin into clean line lists.
whisper
Speech to txt, vtt, srt, and json from an audio file or folder.
youtube-transcript
Public caption tracks to transcript.txt and results.jsonl.
Run openai-file yourself
A scan report and an API key feed openai-file, which prompts an OpenAI model over the file and writes the generated summary as output.
Facts on this page come from the live Trickest tool library.