/**
 * Shared OpenAI-compatible chat streamer.
 *
 * Every provider that speaks the OpenAI Chat Completions dialect (OpenAI
 * itself, NVIDIA, Kimi, Azure, and a long tail of compatible gateways) reuses
 * this single streamer. A connector supplies the endpoint URL, auth headers,
 * and any body overrides; this module handles request assembly, SSE decoding,
 * and translation of the OpenAI streaming chunk format into neutral
 * {@link Emission}s.
 *
 * The OpenAI streaming chunk shape (re-derived from public docs) is:
 *
 *   data: {"choices":[{"delta":{"content":"..."},"finish_reason":null}], ...}
 *   data: {"choices":[{"delta":{"tool_calls":[{"index":0,"id":"call_x",
 *           "function":{"name":"f","arguments":"{\"a"}}]}}]}
 *   data: {"choices":[{"finish_reason":"stop"}],"usage":{...}}
 *   data: [DONE]
 */
import type { Channel, ModelCard, Reply, StreamOptions, Conversation } from "../contract";
/** Connector-supplied endpoint configuration. */
export interface OpenAICompatibleConfig {
    /** Absolute chat-completions URL to POST to. */
    readonly url: string;
    /** Request headers (auth, content-type is added if absent). */
    readonly headers: Record<string, string>;
    /** Extra top-level body fields merged after the standard ones. */
    readonly bodyExtra?: Record<string, unknown>;
}
/**
 * Open a streaming OpenAI-compatible chat invocation as a {@link Channel}.
 *
 * The channel POSTs on first iteration, decodes the SSE body, yields neutral
 * emissions (text/thinking/tool-call/usage/stop), and finishes with a single
 * terminal `done` carrying the folded {@link Reply}. Any failure surfaces as a
 * terminal `error` emission rather than a thrown exception, so consumers can
 * branch on it inline.
 */
export declare function streamOpenAICompatibleChat(cfg: OpenAICompatibleConfig, model: ModelCard, c: Conversation, opts: StreamOptions): Channel;
/**
 * Run an OpenAI-compatible chat invocation to completion (non-streaming view).
 *
 * Built directly on {@link streamOpenAICompatibleChat} + {@link collectReply},
 * so streaming and one-shot share one code path. Throws the underlying
 * {@link GatewayError} on failure.
 */
export declare function completeOpenAICompatibleChat(cfg: OpenAICompatibleConfig, model: ModelCard, c: Conversation, opts: StreamOptions): Promise<Reply>;
