Updated Jul 15, 2026

Utilities

Prompt an OpenAI model over a workflow file

OpenAI chat responses from a file and a prompt.

Python · Apache-2.0 license

Agent

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

7 inputs
NameTypeFlagDescription
input-fileFILE·Input file for the model to read.
promptSTRING·Prompt applied to the file input.
open-ai-api-keyFILE·OpenAI API key, supplied as a file.
gpt-4BOOLEANgpt4Use OpenAI Chat gpt-4 (aliases 4, gpt4).
gpt-4-32kBOOLEAN4-32kUse OpenAI Chat gpt-4-32k for larger context.
gpt-3-5-turboBOOLEANchatgptUse OpenAI Chat gpt-3.5-turbo (aliases 3.5, chatgpt).
gpt-3-5-turbo-16kBOOLEANchatgpt-16kUse 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 · command
# openai-file: summarize hosts.txt with gpt-4
# openai-file input=hosts.txt prompt="List live hosts" gpt4
sample output
Live hosts from the scan:
api.example.com
app.example.com
staging.example.com
dev.example.com
mail.example.com
vpn.example.com
# openai-file summary of 6 hosts

guidance

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

Set one of gpt4, 4-32k, chatgpt, or chatgpt-16k. Match context size and cost to the input file.

As the open-ai-api-key file input, so the credential stays off the command line.

Yes. It calls the OpenAI API. Without a valid key or outbound access, the node cannot return a response.

When the transform is deterministic rendering of structured data. openai-file is for generative summarize, classify, or rewrite.

An input-file, a prompt string, an API key file, and one model flag among gpt4, 4-32k, chatgpt, or chatgpt-16k.

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.