AI providers

Optional bring-your-own-key labelling: use your own Anthropic, OpenAI or Gemini key to relabel the columns Ghostrow is least sure about. Off by default. What is sent and what is not.

Ghostrow understands columns with its own engine, on your machine, with no network access. In some schemas a few column names are unclear, for example ref1 or attr_a. With your own AI key (Pro and Max), Ghostrow can ask a model to label those columns. It is off by default, and nothing is sent unless you set the variables below.

Turn it on

Set GHOSTROW_AI_PROVIDER and that provider's key:

ProviderGHOSTROW_AI_PROVIDERKey variableDefault model
AnthropicanthropicANTHROPIC_API_KEYclaude-haiku-5-5
OpenAIopenaiOPENAI_API_KEYgpt-5-mini
GeminigeminiGEMINI_API_KEYgemini-2.5-flash

Set GHOSTROW_AI_MODEL to use another model.

export GHOSTROW_AI_PROVIDER=anthropic
export ANTHROPIC_API_KEY=...
ghostrow seed --schema schema.sql --dry-run

The run prints a line of this shape to stderr:

ai provider   anthropic (claude-haiku-5-5) relabelled <n> of <m> uncertain column(s); schema text only

Those are the providers the CLI supports today. Ghostrow calls the provider's public API directly with your key. Ghostrow never sees the key or the answers.

What is sent

Only schema text, and only for the columns the built-in engine was least sure about (confidence under 0.6, excluding foreign keys and columns you pinned in the rules file). For each of those columns the request holds one line:

orders.ref1: varchar(30)

That is the table name, the column name and the declared type, plus the list of labels the model may answer with. Ghostrow sends columns in batches of up to 80 and gives each request a 60-second limit.

Never sent: rows, sampled values, your code, your rules file, connection strings or table contents.

What happens to the answer

The model must reply with a label from Ghostrow's fixed list. Ghostrow ignores any other answer, and any label that does not fit the column's type. A change is marked in the rules file with the evidence your AI provider (anthropic) and a confidence of at least 0.7, so you can review it in a diff. The generated data itself always comes from Ghostrow's seeded generator, not from the model.

If something is wrong

SituationResult
A provider name other than anthropic, openai or geminiA warning, and the run goes on with the built-in engine: ai provider skipped: GHOSTROW_AI_PROVIDER must be anthropic, openai or gemini; got "<name>". Using the built-in engine only.
The key variable is missingA warning, and the run goes on with the built-in engine: ai provider skipped: GHOSTROW_AI_PROVIDER=<name> needs <KEY_NAME> to be set. Using the built-in engine only.
The license is not Pro or MaxA note, and the built-in engine is used: GHOSTROW_AI_PROVIDER is set, but bring-your-own-key needs Pro or Max. Using the built-in engine only.
The provider call fails or times outA note, and the run goes on without it: ai provider skipped: <reason>

Because a failed call only skips the labelling, a run in CI with an expired key still produces data. Check stderr if you rely on the labels, and pin the labels in the rules file so they do not depend on a call.

Keep it off in CI

For repeatable CI runs, leave the variables unset and commit the rules file. The labels the model chose are then in the file and are used as they are. See CI.