/**
 * Shared OpenAI chat-completions wire-format helpers used by providers that
 * talk to an OpenAI-shaped /chat/completions endpoint (openai-compatible,
 * litellm, groq, perplexity, xai, fireworks, togetherAi, cohere, cloudflare,
 * huggingFace, llamaCpp, lmStudio, deepseek, nvidiaNim, and openAI itself).
 *
 * Everything in this module is provider-agnostic: pure functions that convert
 * between NeuroLink-shaped values and the OpenAI wire format, plus the SSE
 * parser + queue primitives a streaming provider needs. Provider classes own
 * their own orchestration (executeStream + runStreamLoop) for now — that
 * extraction is a follow-up PR.
 *
 * Nothing here imports from "ai" or "@ai-sdk/*". The whole point of this
 * module is to be the native replacement for the AI SDK's OpenAI wrapper.
 */
import type { OpenAICompatBuildBodyArgs, OpenAICompatChatMessage, OpenAICompatChatRequest, OpenAICompatChatTool, OpenAICompatMessage, OpenAICompatMessageContent, OpenAICompatResponseFormat, OpenAICompatSSEResult, OpenAICompatStreamChunk, OpenAICompatToolChoiceWire, OpenAICompatV3CallToolChoice, OpenAICompatV3CallTools, DeferredUsage, Tool } from "../types/index.js";
export declare const stripTrailingSlash: (s: string) => string;
export declare const safeStringify: (value: unknown) => string;
export declare const stringifyToolInput: (input: unknown) => string;
export declare const stringifyToolOutput: (output: unknown) => string;
export declare const imageDataToURL: (data: unknown) => string | undefined;
export declare const convertContentForOpenAI: (content: unknown) => string | OpenAICompatMessageContent[];
export declare const messageBuilderToOpenAI: (messages: ReadonlyArray<OpenAICompatMessage>) => OpenAICompatChatMessage[];
export declare const buildToolsForOpenAI: (tools: Record<string, Tool>) => OpenAICompatChatTool[] | undefined;
export declare const v3ToolsToOpenAI: (tools: OpenAICompatV3CallTools | undefined) => OpenAICompatChatTool[] | undefined;
export declare const v3ToolChoiceToOpenAI: (choice: OpenAICompatV3CallToolChoice) => OpenAICompatToolChoiceWire | undefined;
export declare const v3ResponseFormatToOpenAI: (rf: {
    type: "text" | "json";
    schema?: Record<string, unknown>;
    name?: string;
    description?: string;
}) => OpenAICompatResponseFormat | undefined;
export declare const mapNeuroLinkToolChoice: (choice: unknown) => OpenAICompatToolChoiceWire | undefined;
export declare const messagesContainJsonWord: (messages: ReadonlyArray<OpenAICompatChatMessage>) => boolean;
export declare const ensureJsonWordInBody: (body: OpenAICompatChatRequest) => OpenAICompatChatRequest;
export declare const requiresMaxCompletionTokens: (modelId: string) => boolean;
export declare const buildBody: (args: OpenAICompatBuildBodyArgs) => OpenAICompatChatRequest;
export declare const parseSSEStream: (body: ReadableStream<Uint8Array>, onTextDelta: (delta: string) => void, onReasoningDelta?: (delta: string) => void) => Promise<OpenAICompatSSEResult>;
export declare const buildAPIError: (url: string, body: OpenAICompatChatRequest, res: Response) => Promise<Error>;
export declare const createDeferredAnalytics: () => {
    usagePromise: Promise<DeferredUsage>;
    finishPromise: Promise<string>;
    resolveUsage: (u: DeferredUsage) => void;
    resolveFinish: (reason: string) => void;
};
export declare const createChunkQueue: () => {
    pushChunk: (c: OpenAICompatStreamChunk) => void;
    nextChunk: () => Promise<OpenAICompatStreamChunk>;
};
export declare const mergeUsage: (a: {
    prompt_tokens?: number;
    completion_tokens?: number;
    total_tokens?: number;
} | undefined, b: {
    prompt_tokens?: number;
    completion_tokens?: number;
    total_tokens?: number;
} | undefined) => {
    prompt_tokens?: number;
    completion_tokens?: number;
    total_tokens?: number;
} | undefined;
