import type { JsonObject, Message, ProviderRequest, ProviderRequestOptions, Usage } from "@arnilo/prism"; /** OpenRouter `session_id` / `x-session-id` documented max length. */ export declare const OPENROUTER_SESSION_ID_MAX_LENGTH = 256; export declare function openRouterSessionId(options: ProviderRequestOptions | undefined): string | undefined; /** * Whether OpenRouter cache_control markers may be emitted for this request. * Caching is enabled when not explicitly disabled (`cacheRetention !== "none"`, * `cache.mode !== "off"`) and the model opts in via `ModelCacheCapabilities` * (`kind: "cache_control"`) or the legacy `compat.openRouterCache` flag. */ export declare function openRouterCacheEnabled(request: ProviderRequest): boolean; /** * Apply Anthropic-style `cache_control` only to the requested Prism breakpoints, * not to every content block. Returns the Prism messages with markers on the * last content block of each selected message; the OpenRouter message converter * preserves those markers. With no breakpoints, no markers are emitted and * OpenRouter's implicit caching (when available) handles prefix reuse. */ export declare function applyOpenRouterCacheControl(request: ProviderRequest): readonly Message[]; /** * Official OpenRouter automatic Anthropic-style caching: a single top-level * `cache_control` when caching is enabled and the host did not select explicit * breakpoints. Prefer breakpoints for fine-grained control. * @see https://openrouter.ai/docs/guides/best-practices/prompt-caching */ export declare function openRouterTopLevelCacheControl(request: ProviderRequest): JsonObject | undefined; /** * Preserve a `cache_control` marker carried on a Prism content block when * converting to the OpenRouter content shape. Marker only lands on the last * block of a breakpoint-selected message (set by `applyOpenRouterCacheControl`). */ export declare function withOpenRouterCacheMarker(contentItem: JsonObject, marker: JsonObject | undefined): JsonObject; export declare function openRouterUsage(usage: OpenRouterUsage | undefined): Usage | undefined; export interface OpenRouterUsage { readonly prompt_tokens?: number; readonly completion_tokens?: number; readonly total_tokens?: number; readonly prompt_tokens_details?: { readonly cached_tokens?: number; readonly cache_write_tokens?: number; }; }