import type { VerifiedRoutingSubject } from '@sentropic/llm-mesh'; import type { CostContext } from './ports/cost-context.js'; import { type ProviderShapedError } from './router/errors.js'; import { type NativeCountTokensRateLimiter } from './native-count-rate.js'; export declare const SAFEGUARDS_NOT_SUPPORTED_MESSAGE = "safeguards is not supported by this gateway route; retry without safeguards."; export declare const COUNT_NOT_SUPPORTED_MESSAGE = "Token counting is not supported by this gateway route."; export declare const COUNT_NOT_SUPPORTED_FOR_REQUEST_MESSAGE = "Token counting is not supported by this gateway route for this request."; export interface NativeCountTokensRequest { readonly body: Record; readonly headers: { readonly forwarded: Readonly>; readonly anthropicVersion: string; }; readonly signal: AbortSignal; readonly requestId: string; } export interface NativeCountTokensResult { readonly kind: 'json'; readonly status: 200; readonly headers: Readonly>; readonly body: Record; } export interface PreparedNativeCountTokens { readonly providerId: string; readonly modelId: string; readonly apiVersions: readonly string[]; /** One JSON count call; cancel/detach all request holders before return. */ execute(request: NativeCountTokensRequest): Promise; } export interface NativeCountTokensPort { /** Same trusted exact-model allowlist discipline as native Messages; never an alias catalog. */ readonly modelIds: readonly string[]; /** Recheck caller partition, catalog and credential availability; unknown catalog model throws unknown-model. */ prepare(subject: VerifiedRoutingSubject, input: { readonly workspaceId?: string; readonly modelId: string; readonly signal: AbortSignal; }): Promise; } export declare class NativeCountTokensRefusal extends Error { readonly response: ProviderShapedError; constructor(response: ProviderShapedError); } /** * Provider-shaped upstream count failure. The host transport builds the * response (status/body/headers) from the provider error, sanitized; the * gateway relays it verbatim on the Anthropic wire. */ export declare class NativeCountUpstreamError extends Error { readonly response: ProviderShapedError; constructor(response: ProviderShapedError); } /** * Authenticated count only: no canonical projection, generation plan, hold, * usage or settlement. The port is the host-owned provider count transport — * real counting happens at the provider; the gateway never estimates (an * estimate would corrupt Anthropic cache accounting, spec §15.2). Absent port: * explicit provider-shaped refusal so the client falls back to its own local * counting. */ export declare const runNativeCountTokens: (options: { readonly port?: NativeCountTokensPort; readonly rate?: NativeCountTokensRateLimiter; }, request: { readonly cost: CostContext; readonly body: unknown; readonly headers: Readonly>; readonly signal: AbortSignal; readonly requestId: string; }) => Promise; //# sourceMappingURL=native-count-tokens.d.ts.map