packages/provider-openai is one of three answer-visibility provider adapters (alongside Gemini and Claude). It queries the OpenAI Responses API with web search enabled to determine which domains are cited in AI-generated answers for tracked keywords.
validateConfig(config: OpenAIConfig): OpenAIHealthcheckResultValidates that the config has a non-empty API key. Returns the model name that will be used.
healthcheck(config: OpenAIConfig): Promise<OpenAIHealthcheckResult>Makes a lightweight OpenAI API call to verify the key works. Returns ok/error with a message.
executeTrackedQuery(input: OpenAITrackedQueryInput): Promise<OpenAIRawResult>Sends the keyword to the OpenAI Responses API with web_search_preview tool enabled. The keyword is sent as-is. Returns:
rawResponse — the full OpenAI API response (output items, usage metadata)groundingSources — extracted { uri, title } pairs from URL citation annotationssearchQueries — web search queries extracted from web_search_call output itemsmodel — the model used (default: gpt-4o)normalizeResult(raw: OpenAIRawResult): OpenAINormalizedResultExtracts analyst-relevant fields from the raw response:
answerText — concatenated text from output_text content items in message outputscitedDomains — unique domains extracted from URL citation annotations (www. stripped)groundingSources — pass-through of { uri, title } pairssearchQueries — pass-through of search queries usedDefault: gpt-4o. Configurable via OpenAIConfig.model.
The provider uses OpenAI’s web search preview tool (web_search_preview). When enabled, the Responses API:
web_search_call output items)output_text content blocksCitation detection works by extracting domains from URL citation annotations. The job runner then matches these against the project’s canonical domain and competitor domains to determine citation state.
new URL()www. prefix is strippedQuota policy is passed via OpenAIConfig.quotaPolicy but enforcement is handled by the job runner (not the provider itself).
The job runner stores the following in query_snapshots.raw_response as JSON:
{
"model": "gpt-4o",
"groundingSources": [
{ "uri": "https://example.com/page", "title": "Page Title" }
],
"searchQueries": ["keyword related search"],
"apiResponse": { "output": [...] }
}
Phase 2: Live OpenAI API calls implemented with Responses API web search. The openai SDK is used for API communication.