import type { BatchJobRef, BatchJobState, BatchOutputItem, BatchProvider, BatchProviderCallContext, BatchProviderInfo, BatchSubmitRequest } from '../types/batch.js'; /** Options for the OpenAI batch provider. */ export interface OpenAIBatchProviderOptions { /** OpenAI API key. */ apiKey: string; /** API base URL. Defaults to `https://api.openai.com/v1`. */ baseUrl?: string; /** Sent as the `OpenAI-Organization` header. */ organization?: string; /** Headers added to every request. */ headers?: Record; /** Replaces the global `fetch`. */ fetch?: typeof fetch; /** Endpoint every item targets. Defaults to chat completions. */ endpoint?: '/v1/chat/completions' | '/v1/embeddings' | (string & {}); } /** * OpenAI's Batch API: half price, 24-hour window. * * The wire protocol is a JSONL upload, a batch pointing at it, then a JSONL download — three * different content types across four endpoints, which is why this adapter is larger than a * synchronous one. */ export declare class OpenAIBatchProvider implements BatchProvider { private readonly options; /** Always `openai`, with its batch limits. */ readonly info: BatchProviderInfo; constructor(options: OpenAIBatchProviderOptions); /** Uploads the items as JSONL and creates a batch over them. */ submit(request: BatchSubmitRequest, context: BatchProviderCallContext): Promise; /** Reads a batch's status and counts. */ poll(ref: BatchJobRef, context: BatchProviderCallContext): Promise; /** Downloads a finished batch's results. Empty until the output file exists. */ results(ref: BatchJobRef, context: BatchProviderCallContext): Promise; /** Cancels a batch. Items already processed keep their results. */ cancel(ref: BatchJobRef, context: BatchProviderCallContext): Promise; private toState; private toOutputItem; private request; private requestText; private send; }