/** * Shared implementation for providers that expose BOTH an OpenAI-compatible * and an Anthropic-compatible API surface against the same model catalog * (currently Kimi Code and Synthetic). * * Each call site supplies the provider-specific bits (base URLs, default * format, optional extra headers); the streaming/forwarding plumbing lives * here once. */ import type { Context, Model, SimpleStreamOptions } from "../types"; import { AssistantMessageEventStream } from "../utils/event-stream"; export type OpenAIAnthropicApiFormat = "openai" | "anthropic"; export interface OpenAIAnthropicShimOptions extends SimpleStreamOptions { /** API format: "openai" or "anthropic". */ format?: OpenAIAnthropicApiFormat; } export interface OpenAIAnthropicShimConfig { /** Base URL for the Anthropic-compatible endpoint (without trailing /v1/messages). */ anthropicBaseUrl: string; /** Optional override for the OpenAI-compatible base URL. If omitted, `model.baseUrl` is used as-is. */ openaiBaseUrl?: string; /** Default API format when caller does not specify one. */ defaultFormat: OpenAIAnthropicApiFormat; /** Provider-specific headers (e.g. auth/session) merged ahead of user-supplied headers. */ extraHeaders?: () => Record; } /** * Stream from an OpenAI-or-Anthropic compatible provider. Returns synchronously; * async header fetching and stream piping happen internally. */ export declare function streamOpenAIAnthropicShim(model: Model<"openai-completions">, context: Context, options: OpenAIAnthropicShimOptions | undefined, config: OpenAIAnthropicShimConfig): AssistantMessageEventStream;