Use OpenAI
The openai provider uses the OpenAI SDK’s first-party API defaults. ParseHawk
stores the key encrypted and sends only inputs for extractors explicitly
assigned to this provider.
Configure the key
Section titled “Configure the key”Export the key in the shell where you run the CLI, then ask ParseHawk to encrypt and store it:
export OPENAI_API_KEY=...parsehawk providers configure openai --api-key-env OPENAI_API_KEY--api-key-env avoids placing the literal secret in shell history. The key is
not returned by provider read endpoints.
Choose a model
Section titled “Choose a model”List model IDs visible to the configured account:
parsehawk providers models openaiAssign an appropriate chat-completions model to a saved extractor:
parsehawk extractors update invoice_v1 \ --provider openai \ --model YOUR_MODEL_IDParseHawk requests structured JSON and streams the response. For image or PDF inputs, choose a model that accepts image content.
Run without the bundled model
Section titled “Run without the bundled model”parsehawk start -x runtimeOnly extractors assigned to openai send document data to OpenAI. Other
extractors keep their own provider selection.
Rotate or clear the key
Section titled “Rotate or clear the key”Run the configure command again to rotate it. To clear the stored value:
parsehawk providers configure openai --api-key ""If you supply PARSEHAWK_SECRET_KEY, keep the same value available to API and
worker processes; losing it makes stored provider keys unreadable.