@bastani/pi-ai 0.9.26-alpha.5 → 0.9.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -24,6 +24,8 @@ export type ToolChoice = "auto" | "none";
24
24
  export type ThinkingLevel = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
25
25
  export type ModelThinkingLevel = "off" | ThinkingLevel;
26
26
  export type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;
27
+ export type SamplingParams = Record<string, unknown>;
28
+ export type SamplingParamsByThinkingLevel = Partial<Record<ModelThinkingLevel, SamplingParams>>;
27
29
  export type ChatTemplateKwargValue = string | number | boolean | null | {
28
30
  $var: "thinking.enabled" | "thinking.effort" | "thinking.budget";
29
31
  omitWhenOff?: boolean;
@@ -128,7 +130,7 @@ export interface StreamOptions extends ProviderRequestOptions<Model<Api>> {
128
130
  * `repetition_penalty`. Merged over `Model.samplingParams` per key. Only applied by
129
131
  * OpenAI-compatible adapters (completions, responses, Azure responses); other APIs ignore it.
130
132
  */
131
- samplingParams?: Record<string, unknown>;
133
+ samplingParams?: SamplingParams;
132
134
  maxTokens?: number;
133
135
  /**
134
136
  * Preferred transport for providers that support multiple transports.
@@ -1077,7 +1079,9 @@ export interface Model<TApi extends Api> extends BaseModel<TApi> {
1077
1079
  contextWindow: number;
1078
1080
  maxTokens: number;
1079
1081
  /** Default sampling parameters for this model. See {@link StreamOptions.samplingParams}; per-request keys override these. */
1080
- samplingParams?: Record<string, unknown>;
1082
+ samplingParams?: SamplingParams;
1083
+ /** Sampling parameter overrides selected by the effective pi thinking level. */
1084
+ samplingParamsByThinkingLevel?: SamplingParamsByThinkingLevel;
1081
1085
  /**
1082
1086
  * Marks this model as the fast-inference variant of {@link ModelFastRoute.baseModelId} and carries the
1083
1087
  * upstream routing it needs. Absent on every normal model.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/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M,CAAC;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC5B,UAAU,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;CAC3C;AAED,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC;AAE3C,iEAAiE;AACjE,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TelemetryContext } from \"@earendil-works/pi-telemetry\";\nimport type { AnthropicOptions } from \"./api/anthropic-messages.ts\";\nimport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nimport type { BedrockOptions } from \"./api/bedrock-converse-stream.ts\";\nimport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nimport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nimport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nimport type { OpenAICodexResponsesOptions } from \"./api/openai-codex-responses.ts\";\nimport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nimport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nimport type { PiMessagesOptions } from \"./api/pi-messages.ts\";\nimport type { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-vertex\"\n\t| \"pi-messages\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImageApi = \"openrouter-images\";\n\nexport type ImageApi = KnownImageApi | (string & {});\n\nexport type KnownClassifierApi = \"typesafe-system-one\" | \"cloudflare-workers-ai-system-one\" | \"llama-cpp-classify\";\n\nexport type ClassifierApi = KnownClassifierApi | (string & {});\n\nexport type KnownProvider =\n\t| \"amazon-bedrock\"\n\t| \"ant-ling\"\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"radius\"\n\t| \"typesafe\"\n\t| \"nvidia\"\n\t| \"deepseek\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"zai-coding-cn\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"moonshotai\"\n\t| \"moonshotai-cn\"\n\t| \"huggingface\"\n\t| \"fireworks\"\n\t| \"together\"\n\t| \"baseten\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"meta\"\n\t| \"cloudflare-workers-ai\"\n\t| \"cloudflare-ai-gateway\"\n\t| \"qwen-token-plan\"\n\t| \"qwen-token-plan-cn\"\n\t| \"qwen-token-plan-individual\"\n\t| \"xiaomi\"\n\t| \"xiaomi-token-plan-cn\"\n\t| \"xiaomi-token-plan-ams\"\n\t| \"xiaomi-token-plan-sgp\";\nexport type ProviderId = KnownProvider | string;\n\nexport type ToolChoice = \"auto\" | \"none\";\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type ModelThinkingLevel = \"off\" | ThinkingLevel;\nexport type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;\nexport type ChatTemplateKwargValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| {\n\t\t\t$var: \"thinking.enabled\" | \"thinking.effort\" | \"thinking.budget\";\n\t\t\tomitWhenOff?: boolean;\n\t };\n\n/** Top-level request field used to cap reasoning tokens on OpenAI-compatible servers. */\nexport type ThinkingTokenBudgetField = \"thinking_token_budget\" | \"thinking_budget\" | \"thinking_budget_tokens\";\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\n/**\n * Best-effort prompt cache lifetime in seconds for each retention tier a request can ask for.\n * A missing tier means the lifetime is unknown; pi does not warm such caches.\n */\nexport type ModelPromptCache = Partial<Record<Exclude<CacheRetention, \"none\">, number>>;\n\nexport type Transport = \"sse\" | \"websocket\" | \"websocket-cached\" | \"auto\";\n\n/** Provider-scoped environment overrides. Values take precedence over process.env. */\nexport type ProviderEnv = Record<string, string>;\nexport type ProviderHeaders = Record<string, string | null>;\nexport type FetchFunction = typeof globalThis.fetch;\nexport type SessionAffinityFormat = \"openai\" | \"openai-nosession\" | \"openrouter\";\n\nexport interface ProviderResponse {\n\tstatus: number;\n\theaders: Record<string, string>;\n}\n\n/** Authentication, HTTP transport, and lifecycle callbacks shared by provider requests. */\nexport interface ProviderRequestOptions<TModel = Model<Api>> {\n\tsignal?: AbortSignal;\n\t/** Explicit parent context for telemetry produced by this logical request. */\n\ttelemetryContext?: TelemetryContext;\n\tapiKey?: string;\n\t/**\n\t * Optional fetch implementation for provider HTTP requests.\n\t * Defaults to `globalThis.fetch`. Provider adapters that cannot inject a custom implementation may reject it.\n\t * This does not affect WebSocket transports.\n\t */\n\tfetch?: FetchFunction;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as regional settings, endpoint placeholders, and\n\t * proxy variables.\n\t */\n\tenv?: ProviderEnv;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: TModel) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received.\n\t */\n\tonResponse?: (response: ProviderResponse, model: TModel) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; caller values override default headers.\n\t * On AWS Bedrock these are injected via a Smithy `build`-step middleware so\n\t * they are covered by SigV4 signing; reserved headers (`x-amz-*`,\n\t * `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t * For example, OpenAI and Anthropic SDK clients default to 10 minutes.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t * For example, OpenAI and Anthropic SDK clients default to 2.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n}\n\nexport interface StreamOptions extends ProviderRequestOptions<Model<Api>> {\n\t/**\n\t * Optional callback invoked after an HTTP response is received and before\n\t * its body stream is consumed.\n\t */\n\tonResponse?: (response: ProviderResponse, model: Model<Api>) => void | Promise<void>;\n\t/**\n\t * Optional observer for each parsed provider stream event before Pi normalization.\n\t * Event data is adapter-owned and must be treated as read-only.\n\t * Adapter support is explicit; unsupported adapters do not invoke it.\n\t */\n\tonProviderStreamEvent?: (data: unknown, model: Model<Api>) => void | Promise<void>;\n\ttemperature?: number;\n\t/**\n\t * Arbitrary sampling parameters merged into the request body as-is, after the named request\n\t * fields, so keys here override them. Lets custom OpenAI-compatible servers (llama.cpp, vLLM,\n\t * SGLang, ...) receive parameters pi does not model, e.g. `top_p`, `top_k`, `min_p`,\n\t * `repetition_penalty`. Merged over `Model.samplingParams` per key. Only applied by\n\t * OpenAI-compatible adapters (completions, responses, Azure responses); other APIs ignore it.\n\t */\n\tsamplingParams?: Record<string, unknown>;\n\tmaxTokens?: number;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * WebSocket connect timeout in milliseconds for providers that support\n\t * WebSocket transports. This covers the connection/open handshake only;\n\t * HTTP/SDK idleness uses `timeoutMs`, while gaps between decoded provider\n\t * stream events use `streamDeadlineMs`.\n\t */\n\twebsocketConnectTimeoutMs?: number;\n\t/**\n\t * Maximum idle gap in milliseconds between two provider stream events.\n\t *\n\t * Enforced below the HTTP layer, so a response body that stalls without ever\n\t * rejecting the adapter's async iterator (for example a decompression failure\n\t * that destroys the stream silently, #2553) still settles the attempt as a\n\t * retryable transport error instead of hanging forever. The timer restarts on\n\t * every event, so it never caps total stream duration.\n\t *\n\t * Defaults to 300000 ms. `0` (or any non-positive value) disables it.\n\t */\n\tstreamDeadlineMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\nexport interface DeferredFetchOptions extends ProviderRequestOptions<Model<Api>> {\n\t/**\n\t * Maximum provider long-poll duration in milliseconds.\n\t * Defaults to 0, which performs one status check.\n\t */\n\twait?: number;\n}\n\n/** Request options for best-effort deferred-response cancellation. */\nexport type DeferredCancelOptions = ProviderRequestOptions<Model<Api>>;\n\n/**\n * Maps known APIs to their full provider-specific stream option types.\n * Type-only imports from API implementation modules are erased at emit, so\n * this is tree-shake safe.\n */\nexport interface ApiOptionsMap {\n\t\"anthropic-messages\": AnthropicOptions;\n\t\"openai-completions\": OpenAICompletionsOptions;\n\t\"openai-responses\": OpenAIResponsesOptions;\n\t\"openai-codex-responses\": OpenAICodexResponsesOptions;\n\t\"azure-openai-responses\": AzureOpenAIResponsesOptions;\n\t\"google-generative-ai\": GoogleOptions;\n\t\"google-vertex\": GoogleVertexOptions;\n\t\"mistral-conversations\": MistralOptions;\n\t\"bedrock-converse-stream\": BedrockOptions;\n\t\"pi-messages\": PiMessagesOptions;\n}\n\n/**\n * Full stream options for an API. Known APIs resolve to their concrete option\n * type; custom API strings fall back to the generic shape.\n */\nexport type ApiStreamOptions<TApi extends Api> = TApi extends keyof ApiOptionsMap\n\t? ApiOptionsMap[TApi]\n\t: StreamOptions & Record<string, unknown>;\n\n/**\n * The uniform stream contract of an API implementation module: every module\n * under `src/api/` exports `stream` and `streamSimple`; capable modules may also\n * export deferred-response methods. Lazy wrappers (`lazyApi()`) and provider\n * factories pass these around as values. This is the untyped dispatch shape;\n * per-API option typing lives on the implementation modules themselves and on\n * `Provider.stream()` via `ApiStreamOptions`.\n */\nexport interface ProviderStreams {\n\tstream(model: Model<Api>, context: TranscriptContext, options?: StreamOptions): AssistantMessageEventStream;\n\tstreamSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: TranscriptContext,\n\t\toptions?: SimpleStreamOptions,\n\t): AssistantMessageEventStream;\n\tfetchDeferred?(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: DeferredFetchOptions,\n\t): AssistantMessageEventStream;\n\tcancelDeferred?(model: Model<Api>, handle: DeferredHandle, options?: DeferredCancelOptions): Promise<void>;\n}\n\n/**\n * The uniform contract of an image-generation API implementation module:\n * every image API module under `src/api/` exports exactly `generateImages`,\n * so the module itself satisfies this interface. Lazy wrappers and\n * `createProvider({ images })` pass these around as values.\n */\nexport interface ProviderImages {\n\tgenerateImages(\n\t\tmodel: ImageModel<ImageApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ImagesOptions,\n\t): Promise<AssistantImages>;\n}\n\n/** The uniform contract implemented by classifier API modules. */\nexport interface ProviderClassifier {\n\tclassify(\n\t\tmodel: ClassifierModel<ClassifierApi>,\n\t\tcontext: ClassifierContext,\n\t\toptions?: ClassifierOptions,\n\t): Promise<ClassifierResult>;\n}\n\nexport interface ClassifierOptions extends ProviderRequestOptions<ClassifierModel<ClassifierApi>> {\n\t/**\n\t * Divides the answer logits by this value before they are normalized into probabilities.\n\t * Values above 1 soften the distribution; values below 1 sharpen it. Must be positive.\n\t * APIs that cannot apply it ignore it.\n\t */\n\ttemperature?: number;\n}\n\nexport interface ImagesOptions extends ProviderRequestOptions<ImageModel<ImageApi>> {\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderImagesOptions = ImagesOptions & Record<string, unknown>;\n\nexport interface AnthropicAllowedFallbackModel {\n\tprovider: ProviderId;\n\tmodel: string;\n\tcost: ModelCost;\n}\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\t/** Provider-neutral tool selection for simple requests. When omitted, adapters use provider-specific behavior. */\n\ttoolChoice?: ToolChoice;\n\treasoning?: ThinkingLevel;\n\t/** Ask a capable provider to return a durable handle and continue the request asynchronously. */\n\tdeferred?: boolean | { window?: \"15m\" | \"1h\" | \"24h\" };\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options.\n//\n// Contract:\n// - Receives a normalized transcript: the system prompt and tools live in the\n// leading system message, never on the context itself.\n// - Must return an AssistantMessageEventStream.\n// - Direct streamSimple() calls may throw synchronously when request auth is\n// missing. Once a stream is returned, request/model/runtime failures should\n// be encoded in the stream, not thrown.\n// - Error termination must produce an AssistantMessage with stopReason\n// \"error\" or \"aborted\" and errorMessage, emitted via the stream protocol.\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: TranscriptContext,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport type ImagesFunction<TOptions extends ImagesOptions = ImagesOptions> = (\n\tmodel: ImageModel<ImageApi>,\n\tcontext: ImagesContext,\n\toptions?: TOptions,\n) => Promise<AssistantImages>;\n\nexport type ClassifierFunction<TOptions extends ClassifierOptions = ClassifierOptions> = (\n\tmodel: ClassifierModel<ClassifierApi>,\n\tcontext: ClassifierContext,\n\toptions?: TOptions,\n) => Promise<ClassifierResult>;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\tthinkingSignature?: string; // Provider-specific opaque or serialized reasoning replay data\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\n/**\n * Boundary marker emitted by Anthropic server-side fallback, where one model's output gives way\n * to the next after a classifier refusal.\n *\n * This is public content rather than a stream-only event because it must survive the round trip:\n * \"Keep it exactly where it appeared. The API uses its position to validate the thinking blocks\n * around it, so a request that echoes thinking blocks from both sides of the boundary is rejected\n * if the block is omitted or moved.\"\n * https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback\n */\nexport interface FallbackContent {\n\ttype: \"fallback\";\n\t/** The model that declined. Echoes the model string sent when the declining hop is the request's own model. */\n\tfromModel: string;\n\t/** Resolved id of the model that continues. Always present. */\n\ttoModel: string;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\"\n}\n\n/**\n * A document sent as model input, currently PDF only.\n *\n * Anthropic documents PDF as a platform capability — \"All active models support PDF processing\" —\n * routed through the same vision path as images, so it is not a per-model modality. A model\n * advertises it through `Model.input` containing `\"pdf\"`, which generated metadata sets only for\n * the runtimes that can actually serialize a document block. Providers that cannot are sent a\n * visible placeholder instead, exactly as they are for images they cannot accept.\n * https://platform.claude.com/docs/en/build-with-claude/pdf-support\n */\nexport interface DocumentContent {\n\ttype: \"document\";\n\t/** Base64-encoded document bytes. Amazon Bedrock takes raw bytes and decodes this itself. */\n\tdata: string;\n\t/**\n\t * The only media type either serializer implements. It is a literal rather than `string`\n\t * because both paths hardcode PDF — the Anthropic block emits `BetaBase64PDFSource`, whose\n\t * `media_type` is itself a fixed literal, and Bedrock emits `DocumentFormat.PDF` — so a wider\n\t * type would let a caller label arbitrary bytes as a PDF. Widening this union later is\n\t * non-breaking; narrowing it after release would not be. Note that adding a format is not a\n\t * media-type swap on the Anthropic side: plain text needs a structurally different source\n\t * variant (`BetaPlainTextSource`, `type: \"text\"`), and Bedrock's `doc`/`docx`/`xls`/`xlsx`/\n\t * `csv`/`html`/`md` formats have no Anthropic source variant at all.\n\t */\n\tmimeType: \"application/pdf\";\n\t/**\n\t * Optional caller-supplied label. Amazon Bedrock requires a name and warns that it \"is\n\t * vulnerable to prompt injections\", so the Bedrock path sanitizes this to the characters AWS\n\t * permits and falls back to a neutral generated name.\n\t */\n\tname?: string;\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: JsonObject;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n\t/** OpenAI Responses namespace for calls to dynamically loaded or namespaced tools. */\n\tnamespace?: string;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\t/** Subset of `cacheWrite` written with 1h retention. Anthropic and Bedrock report this split. */\n\tcacheWrite1h?: number;\n\t/**\n\t * Reasoning/thinking tokens, when the provider reports them. This is a subset of\n\t * `output`: `output` already includes these tokens. Set to a number (possibly 0) by\n\t * providers that expose a reasoning breakdown; left undefined by providers that don't.\n\t */\n\treasoning?: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"pending\" | \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\" | \"deferred\";\n\nexport type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject;\nexport type JsonObject = { [key: string]: JsonValue };\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype IsExactlyJsonValue<T> = [T] extends [JsonValue] ? ([JsonValue] extends [T] ? true : false) : false;\ntype IsJsonProperty<T> =\n\tIsAny<T> extends true\n\t\t? false\n\t\t: unknown extends T\n\t\t\t? false\n\t\t\t: [Exclude<T, undefined>] extends [never]\n\t\t\t\t? true\n\t\t\t\t: IsJsonCompatible<Exclude<T, undefined>>;\ntype InvalidJsonKeys<T extends object> = {\n\t[TKey in keyof T]-?: TKey extends string | number ? (IsJsonProperty<T[TKey]> extends true ? never : TKey) : TKey;\n}[keyof T];\ntype IsJsonCompatible<T> =\n\tIsAny<T> extends true\n\t\t? false\n\t\t: unknown extends T\n\t\t\t? false\n\t\t\t: IsExactlyJsonValue<T> extends true\n\t\t\t\t? true\n\t\t\t\t: T extends null | boolean | number | string\n\t\t\t\t\t? true\n\t\t\t\t\t: T extends undefined\n\t\t\t\t\t\t? false\n\t\t\t\t\t\t: T extends readonly (infer TItem)[]\n\t\t\t\t\t\t\t? IsJsonCompatible<TItem>\n\t\t\t\t\t\t\t: T extends (...args: never[]) => unknown\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t\t? [InvalidJsonKeys<T>] extends [never]\n\t\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t: false;\n\n/** The JSON representation of a typed in-memory value. Optional object properties remain optional. */\nexport type JsonRepresentation<T> =\n\tIsAny<T> extends true\n\t\t? JsonValue\n\t\t: unknown extends T\n\t\t\t? JsonValue\n\t\t\t: [T] extends [JsonValue]\n\t\t\t\t? T\n\t\t\t\t: T extends readonly unknown[]\n\t\t\t\t\t? { [TKey in keyof T]: JsonRepresentation<Exclude<T[TKey], undefined>> }\n\t\t\t\t\t: T extends object\n\t\t\t\t\t\t? { [TKey in keyof T]: JsonRepresentation<Exclude<T[TKey], undefined>> }\n\t\t\t\t\t\t: never;\n\nexport interface DeferredHandle {\n\tprovider: string;\n\tmodelId: string;\n\tapi: string;\n\t/** Provider token, such as a response id or batch id plus row id. */\n\tid: string;\n\texpiresAt?: number;\n\tpollAfterMs?: number;\n\t/** Provider conversion data required to reconstruct the final assistant message. */\n\tdata?: JsonValue;\n}\n\n/**\n * System instructions and tool declarations at one point in the transcript.\n *\n * The leading system message is the system prompt. Later system messages change it:\n * `content` adds instructions from that point on, `sections` replace or remove named\n * prompt sections, and `toolsAdded`/`toolsRemoved` change the tool set. Replaying\n * every system message in order yields the current prompt and tools. Providers that\n * accept system messages mid-conversation send each one in place; other providers\n * rebuild the leading system message from the replayed state.\n */\nexport interface SystemMessage {\n\trole: \"system\";\n\t/** Instruction text. On the leading message this is the base prompt; later, additional instructions. */\n\tcontent: string | TextContent[];\n\t/**\n\t * Named, ordered prompt sections rendered verbatim after `content`. The leading message\n\t * declares them; later messages replace sections by name, and `null` removes one. Keep\n\t * each section self-delimiting (a tag, a heading) so the model can relate an update to\n\t * the original. Avoid integer-like names; JSON objects reorder those.\n\t */\n\tsections?: Record<string, string | null>;\n\t/** Complete definitions of tools that become available at this point. */\n\ttoolsAdded?: Tool[];\n\t/** Tools that stop being available at this point. */\n\ttoolsRemoved?: ToolReference[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent | DocumentContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | FallbackContent)[];\n\tapi: Api;\n\tprovider: ProviderId;\n\tmodel: string;\n\tresponseModel?: string; // Concrete model reported by the provider when different from the requested `model`\n\tresponseId?: string; // Provider-specific response/message identifier when the upstream API exposes one\n\t/** Exact provider-native effort level used for this response. Absent for legacy or unmanaged responses. */\n\tproviderThinkingLevel?: string;\n\tdiagnostics?: AssistantMessageDiagnostic[]; // Redacted provider/runtime diagnostics for failures and recoveries.\n\tusage: Usage;\n\tstopReason: StopReason;\n\tdeferred?: DeferredHandle;\n\terrorMessage?: string;\n\trawStopReason?: string;\n\t/**\n\t * Provider indication of whether the model explicitly ended its turn.\n\t * Preserved for debugging and does not currently affect agent control flow.\n\t */\n\tendTurn?: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\n/** A tool call made by another tool, such as a codemode script. */\nexport interface NestedToolCallRecord {\n\tid: string;\n\tname: string;\n\t/** Omitted when over the size limits. */\n\targuments?: JsonObject;\n\t/** UTF-8 JSON size when arguments are omitted. */\n\targumentsBytes?: number;\n\tstatus: \"ok\" | \"error\" | \"unfinished\";\n\tdurationMs?: number;\n\terror?: string;\n}\n\n/** Bounded nested-call record. Results are not recorded. */\nexport interface NestedToolCalls {\n\tcalls: NestedToolCallRecord[];\n\tcomplete: boolean;\n}\n\nexport type ToolResultMessage<TDetails = JsonValue> =\n\tIsJsonCompatible<TDetails> extends true\n\t\t? {\n\t\t\t\trole: \"toolResult\";\n\t\t\t\ttoolCallId: string;\n\t\t\t\ttoolName: string;\n\t\t\t\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\t\t\t\tdetails?: JsonRepresentation<TDetails>;\n\t\t\t\t/** Usage from the tool execution itself, if available. Not part of main LLM context accounting. */\n\t\t\t\tusage?: Usage;\n\t\t\t\t/** Nested calls retained in the session, not sent to the model. */\n\t\t\t\tnestedCalls?: NestedToolCalls;\n\t\t\t\tisError: boolean;\n\t\t\t\ttimestamp: number; // Unix timestamp in milliseconds\n\t\t\t}\n\t\t: never;\n\nexport type Message = SystemMessage | UserMessage | AssistantMessage | ToolResultMessage;\n\nexport type ImagesInputContent = TextContent | ImageContent;\nexport type ImagesOutputContent = TextContent | ImageContent;\n\nexport interface ImagesContext {\n\tinput: ImagesInputContent[];\n}\n\nexport type ImagesStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface AssistantImages {\n\tapi: ImageApi;\n\tprovider: ProviderId;\n\tmodel: string;\n\toutput: ImagesOutputContent[];\n\tresponseId?: string;\n\tusage?: Usage;\n\tstopReason: ImagesStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface ClassifierChoiceQuestion {\n\ttype: \"choice\";\n\tinstructions: string;\n\tcriteria: Record<string, string>;\n}\n\nexport interface ClassifierScoreQuestion {\n\ttype: \"score\";\n\tinstructions: string;\n\tcriteria: string[];\n}\n\nexport interface ClassifierBoolQuestion {\n\ttype: \"bool\";\n\tinstructions: string;\n\tcriteria: { true: string; false: string };\n}\n\nexport type ClassifierQuestion = ClassifierChoiceQuestion | ClassifierScoreQuestion | ClassifierBoolQuestion;\n\nexport interface ClassifierContext {\n\tstate: JsonObject;\n\tquestions: Record<string, ClassifierQuestion>;\n}\n\nexport interface ClassifierChoiceAnswer {\n\ttype: \"choice\";\n\tchoice: string;\n\tprobabilities: Record<string, number>;\n\tconfidence: number;\n}\n\nexport interface ClassifierScoreAnswer {\n\ttype: \"score\";\n\tscore: number;\n\tconfidence: number;\n}\n\nexport interface ClassifierBoolAnswer {\n\ttype: \"bool\";\n\tprobability: number;\n}\n\nexport type ClassifierAnswer = ClassifierChoiceAnswer | ClassifierScoreAnswer | ClassifierBoolAnswer;\nexport type ClassifierStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface ClassifierResult {\n\tapi: ClassifierApi;\n\tprovider: ProviderId;\n\tmodel: string;\n\tanswers: Record<string, ClassifierAnswer>;\n\t/** Token usage and cost at the model's catalog price, when reported. */\n\tusage?: Usage;\n\tstopReason: ClassifierStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nimport type { TSchema } from \"typebox\";\n\n/** OpenAI grammar variants for constrained sampling. */\nexport type GrammarFormat = \"openai_lark\" | \"openai_regex\";\n\nexport type GrammarVariants = Partial<Record<GrammarFormat, string>>;\n\n/**\n * Optional provider-side constrained sampling configs for a tool.\n *\n * The `json_schema` value roughly maps to the concept of `strict` in APIs which is\n * implemented as json-schema constrained sampling by APIs. Grammar variants let\n * callers provide provider-specific encodings of the same intended language.\n */\nexport type ConstrainedSamplingConfig =\n\t| {\n\t\t\ttype: \"json_schema\";\n\t\t\tstrict: \"prefer\" | \"require\";\n\t }\n\t| {\n\t\t\ttype: \"grammar\";\n\t\t\tvariants: GrammarVariants;\n\t };\n\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n}\n\nexport interface ToolReference {\n\tname: string;\n}\n\n/**\n * Request input accepted by the public stream entry points (`Models.stream()`,\n * `streamSimple()`, ...). `systemPrompt` and `tools` are shorthand for a leading\n * system message; `normalizeContext()` folds them into one before the request\n * reaches a provider.\n */\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\ndeclare const transcriptContextBrand: unique symbol;\n\n/**\n * Normalized request context passed to providers and API implementations. The\n * prompt and tool declarations are carried by the transcript's system messages.\n * Only `normalizeContext()` produces this type, so a raw `Context` cannot reach\n * provider code by accident.\n */\nexport type TranscriptContext = {\n\tmessages: Message[];\n\treadonly [transcriptContextBrand]: true;\n};\n\n/**\n * Event protocol for AssistantMessageEventStream.\n *\n * Successful streams emit `start` before partial updates and terminate with\n * `done`. A stream may terminate directly with `error` when request setup fails\n * before generation starts; after `start`, failures also terminate with `error`.\n * Direct `streamSimple()` calls throw synchronously when request auth is missing.\n * Updates and `done` must never appear before `start`.\n *\n * Tool-call arguments at `toolcall_start` are provider-specific;\n * `toolcall_delta` carries subsequent JSON updates.\n */\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage }\n\t| {\n\t\t\ttype: \"done\";\n\t\t\treason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\" | \"deferred\">;\n\t\t\tmessage: AssistantMessage;\n\t }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/**\n\t * Whether the model accepts the `temperature` request field. Claude Fable 5.1 rejects\n\t * non-default `temperature`, `top_p`, and `top_k` on every request, and OpenRouter's own\n\t * `supported_parameters` for that model omits `temperature`. When false, the provider\n\t * omits `temperature` and also strips `temperature`, `top_p`, and `top_k` from\n\t * `samplingParams`, which is otherwise merged last and would reopen them.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`tool_choice` `\"required\"` or\n\t * `{ type: \"function\", ... }`). Claude Fable 5.1 rejects it on every request, whichever\n\t * platform serves the model. When false, the provider rejects a forced choice with an error\n\t * rather than sending a request the model cannot honor. `\"auto\"` and `\"none\"` are never\n\t * altered. https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Whether streamed responses include `finish_reason`. When false, pi infers `stop` or `toolUse` when the stream ends. Default: true. */\n\tsupportsFinishReason?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */\n\trequiresReasoningContentOnAssistantMessages?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning: { effort }, \"deepseek\" uses thinking: { type } plus reasoning_effort when supported, \"together\" uses reasoning: { enabled } plus reasoning_effort when supported, \"baseten\" uses configurable chat_template_args plus reasoning_effort when supported, \"zai\" uses thinking: { type }, \"qwen\" uses top-level enable_thinking: boolean, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking: string, and \"ant-ling\" uses reasoning: { effort } only when the mapped effort is non-null. Default: \"openai\". */\n\tthinkingFormat?:\n\t\t| \"openai\"\n\t\t| \"openrouter\"\n\t\t| \"deepseek\"\n\t\t| \"together\"\n\t\t| \"baseten\"\n\t\t| \"zai\"\n\t\t| \"qwen\"\n\t\t| \"chat-template\"\n\t\t| \"qwen-chat-template\"\n\t\t| \"string-thinking\"\n\t\t| \"ant-ling\";\n\t/** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ \"$var\": \"thinking.enabled\" }`, `{ \"$var\": \"thinking.effort\" }`, or `{ \"$var\": \"thinking.budget\" }` for pi-controlled thinking values. */\n\tchatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;\n\t/** Arguments to send as `chat_template_args` when `thinkingFormat` is `baseten`. Use `{ \"$var\": \"thinking.enabled\" }`, `{ \"$var\": \"thinking.effort\" }`, or `{ \"$var\": \"thinking.budget\" }` for pi-controlled thinking values. */\n\tchatTemplateArgs?: Record<string, ChatTemplateKwargValue>;\n\t/** OpenRouter-compatible routing preferences sent as the `provider` request field. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */\n\tzaiToolStream?: boolean;\n\t/**\n\t * Top-level request field used to cap reasoning tokens from `thinkingBudgets`.\n\t * Reasoning and the answer share `max_tokens` on these endpoints, so without a budget a\n\t * reasoning-heavy turn can consume the whole response and emit no answer.\n\t * `\"thinking_token_budget\"` is vLLM, `\"thinking_budget\"` is Qwen/DashScope/SGLang,\n\t * `\"thinking_budget_tokens\"` is llama.cpp. Off by default; not set on the generated catalog.\n\t */\n\tthinkingTokenBudgetField?: ThinkingTokenBudgetField;\n\t/** Alias for `thinkingTokenBudgetField: \"thinking_token_budget\"` (vLLM). Prefer `thinkingTokenBudgetField`. Default: false. */\n\tsupportsThinkingTokenBudget?: boolean;\n\t/** Whether the provider supports OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false; the generated model catalog enables it for verified models. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Whether system messages can introduce additional tools mid-conversation. Requires `supportsMidConvoSystemMessages`. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsMidConvoToolAdditions?: boolean;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: false; generated capable models enable it explicitly. */\n\tsupportsStrictMode?: boolean;\n\t/** Cache control convention for prompt caching. \"anthropic\" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. */\n\tcacheControlFormat?: \"anthropic\";\n\t/** Whether to send session-affinity data from `options.sessionId`. Default: true for OpenRouter endpoints, false otherwise. */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id`, `x-client-request-id`, and `x-session-affinity`; `openai-nosession` sends `x-client-request-id` and `x-session-affinity`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention (`prompt_cache_retention: \"24h\"` or Anthropic-style `cache_control.ttl: \"1h\"`, depending on format). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * vLLM scheduler priority sent as the top-level `priority` request field (lower values are\n\t * handled earlier; server default 0). Only meaningful when vLLM runs with\n\t * `--scheduling-policy priority`; useful for keeping background/batch work from stalling\n\t * interactive sessions. Off by default; not set on the generated catalog.\n\t */\n\tvllmPriority?: number;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: true. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false; the generated model catalog enables it for verified models. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id` and `x-client-request-id`; `openai-nosession` sends `x-client-request-id`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention. This uses `prompt_cache_options.ttl: \"30m\"` on GPT-5.6+ and `prompt_cache_retention: \"24h\"` on earlier models. Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/** Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. */\n\tsupportsStrictMode?: boolean;\n\t/** Whether to emit OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the model supports message-anchored `additional_tools` input items. Default: false. */\n\tsupportsAdditionalTools?: boolean;\n\t/** Whether the model supports client-executed tool search for transcript-anchored additions. Default: false. */\n\tsupportsToolSearch?: boolean;\n\t/** Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+ prompt caching). Older OpenAI models reject the parameter. Default: false. */\n\tsupportsExplicitPromptCacheMode?: boolean;\n\t/** Whether the provider accepts the `max_output_tokens` parameter. Some Codex-protocol gateways reject it. Default: true. */\n\tsupportsMaxOutputTokens?: boolean;\n}\n\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat {\n\t/**\n\t * Whether the provider accepts per-tool `eager_input_streaming`.\n\t * When false, the Anthropic provider omits `tools[].eager_input_streaming`\n\t * and sends the legacy `fine-grained-tool-streaming-2025-05-14` beta header\n\t * for tool-enabled requests.\n\t * Default: true.\n\t */\n\tsupportsEagerToolInputStreaming?: boolean;\n\t/** Whether the provider supports Anthropic long cache retention (`cache_control.ttl: \"1h\"`). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * Whether to send a session-affinity header from `options.sessionId`\n\t * when caching is enabled. Required for providers like Fireworks that use\n\t * session affinity for prompt cache routing (requests to the same replica\n\t * maximize cache hits).\n\t * Default: true for OpenRouter endpoints, false otherwise.\n\t */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Session-affinity format. `\"openrouter\"` sends `x-session-id`; defaults to that format for OpenRouter endpoints and `x-session-affinity` elsewhere. */\n\tsessionAffinityFormat?: \"openrouter\";\n\t/**\n\t * Whether the provider supports Anthropic-style `cache_control` markers on\n\t * tool definitions. When false, `cache_control` is omitted from tool params.\n\t * Some Anthropic-compatible providers (e.g., Fireworks) do not support this\n\t * field on tools and may reject or ignore it.\n\t * Default: true.\n\t */\n\tsupportsCacheControlOnTools?: boolean;\n\t/**\n\t * Whether the model accepts the Anthropic `temperature` request field.\n\t * Claude Opus 4.7+ rejects non-default temperature values.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/**\n\t * Whether to force adaptive thinking (`thinking.type: \"adaptive\"` plus\n\t * `output_config.effort`) regardless of the model id. Built-in models that\n\t * require adaptive thinking set this in generated metadata. Custom\n\t * Anthropic-compatible providers can set this to `true` for any model whose\n\t * upstream requires the adaptive format. Set to `false` to\n\t * opt out on overridden built-in models.\n\t * Default: false.\n\t */\n\tforceAdaptiveThinking?: boolean;\n\t/** Whether to replay empty thinking signatures as `signature: \"\"` instead of converting thinking to text. Default: false. */\n\tallowEmptySignature?: boolean;\n\t/** Whether the provider supports Anthropic strict tool schemas. Default: false; generated Anthropic models enable it explicitly. */\n\tsupportsStrictTools?: boolean;\n\t/** Whether the exact model transport supports effort-only system messages and thinking binding controls. Default: false. */\n\tsupportsMidConvoEffort?: boolean;\n\t/** Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt. Default: false. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Whether the exact model accepts mid-conversation `tool_addition` blocks with inline tool definitions (`inline-tools-2026-09-15`) and `tool_removal` blocks. Requires `supportsMidConvoSystemMessages`. Default: false. */\n\tsupportsMidConvoToolChanges?: boolean;\n\t/**\n\t * Models Anthropic accepts in `fallbacks` for server-side refusal fallback,\n\t * with local pricing metadata for returned fallback responses. When absent or\n\t * empty, callers must omit `fallbacks`; Anthropic rejects the field for models\n\t * with no permitted fallback targets.\n\t */\n\tallowedFallbackModels?: AnthropicAllowedFallbackModel[];\n\t/**\n\t * Whether the model runs Anthropic's preserved-thinking *conversation* check, which\n\t * rejects a request whose `system` prompt, `tools`, or earlier messages changed since a\n\t * replayed thinking block was produced. When true the provider sends the\n\t * `thinking-binding-controls-2026-08-01` beta header and\n\t * `thinking.block_binding.prefix_mismatch_behavior: \"drop_block\"`, so a changed prefix\n\t * drops the affected thinking blocks instead of failing the request with a 400.\n\t * Enforced by default for Anthropic accounts created on or after 2026-08-31.\n\t * Default: false.\n\t */\n\tenforcesPreservedThinkingBinding?: boolean;\n\t/**\n\t * Whether the API adjudicates thinking-block *model* binding itself, always dropping a\n\t * block the target model cannot read. When true, an assistant turn produced by a\n\t * different model on the same provider and API replays its signed `thinking` and\n\t * `redacted_thinking` blocks unchanged rather than being rewritten into plain text, so a\n\t * mid-conversation model switch keeps reasoning the target model is allowed to read.\n\t * Default: false.\n\t */\n\tdelegatesThinkingModelBinding?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`tool_choice: {\"type\": \"any\"}` or\n\t * `{\"type\": \"tool\", ...}`). Claude Fable 5.1 and Claude Mythos 5.1 reject it on every\n\t * request with a 400; Anthropic's guidance for those models is to use\n\t * `tool_choice: {\"type\": \"auto\"}` with strict tool use or structured outputs instead.\n\t * When false, the provider rejects a forced choice with an error rather than sending a\n\t * request the model is guaranteed to refuse, or silently substituting a different one.\n\t * `auto` and `none` are never altered.\n\t * https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n}\n\n/** Compatibility settings for Amazon Bedrock models. */\nexport interface BedrockCompat {\n\t/** Whether the model supports Bedrock strict tool schemas. Default: false. */\n\tsupportsStrictMode?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`toolChoice` `\"any\"` or `{ type: \"tool\" }`).\n\t * Claude Fable 5.1 rejects it on every request with a 400, whichever platform serves the\n\t * model. When false, the provider rejects a forced choice with an error rather than sending\n\t * a request that is guaranteed to fail. `auto` and `none` are never altered.\n\t * https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/**\n\t * Whether the model accepts `inferenceConfig.temperature`. Claude Fable 5.1 rejects\n\t * non-default `temperature`, `top_p`, and `top_k` on every request. When false, the\n\t * provider omits the field.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n}\n\n/** Compatibility settings for the Mistral chat API. */\nexport interface MistralConversationsCompat {\n\t/** Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false. */\n\tsupportsMidConvoSystemMessages?: boolean;\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * Sent as the `provider` field in the OpenRouter API request body.\n * @see https://openrouter.ai/docs/guides/routing/provider-selection\n */\nexport interface OpenRouterRouting {\n\t/** Whether to allow backup providers to serve requests. Default: true. */\n\tallow_fallbacks?: boolean;\n\t/** Whether to filter providers to only those that support all parameters in the request. Default: false. */\n\trequire_parameters?: boolean;\n\t/** Data collection setting. \"allow\" (default): allow providers that may store/train on data. \"deny\": only use providers that don't collect user data. */\n\tdata_collection?: \"deny\" | \"allow\";\n\t/** Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. */\n\tzdr?: boolean;\n\t/** Whether to restrict routing to only models that allow text distillation. */\n\tenforce_distillable_text?: boolean;\n\t/** An ordered list of provider names/slugs to try in sequence, falling back to the next if unavailable. */\n\torder?: string[];\n\t/** List of provider names/slugs to exclusively allow for this request. */\n\tonly?: string[];\n\t/** List of provider names/slugs to skip for this request. */\n\tignore?: string[];\n\t/** A list of quantization levels to filter providers by (e.g., [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"]). */\n\tquantizations?: string[];\n\t/** Sorting strategy. Can be a string (e.g., \"price\", \"throughput\", \"latency\") or an object with `by` and `partition`. */\n\tsort?:\n\t\t| string\n\t\t| {\n\t\t\t\t/** The sorting metric: \"price\", \"throughput\", \"latency\". */\n\t\t\t\tby?: string;\n\t\t\t\t/** Partitioning strategy: \"model\" (default) or \"none\". */\n\t\t\t\tpartition?: string | null;\n\t\t };\n\t/** Maximum price per million tokens (USD). */\n\tmax_price?: {\n\t\t/** Price per million prompt tokens. */\n\t\tprompt?: number | string;\n\t\t/** Price per million completion tokens. */\n\t\tcompletion?: number | string;\n\t\t/** Price per image. */\n\t\timage?: number | string;\n\t\t/** Price per audio unit. */\n\t\taudio?: number | string;\n\t\t/** Price per request. */\n\t\trequest?: number | string;\n\t};\n\t/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_min_throughput?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Minimum tokens/second at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Minimum tokens/second at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Minimum tokens/second at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Minimum tokens/second at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n\t/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_max_latency?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Maximum latency in seconds at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Maximum latency in seconds at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Maximum latency in seconds at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Maximum latency in seconds at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\nexport interface ModelCostRates {\n\tinput: number; // $/million tokens\n\toutput: number; // $/million tokens\n\tcacheRead: number; // $/million tokens\n\tcacheWrite: number; // $/million tokens\n}\n\nexport interface ModelCostTier extends ModelCostRates {\n\t/** Use this tier for requests whose total input usage exceeds this token count. */\n\tinputTokensAbove: number;\n}\n\nexport interface ModelCost extends ModelCostRates {\n\t/** Request-wide pricing tiers. The highest matching input threshold applies to the full request. */\n\ttiers?: ModelCostTier[];\n}\n\nexport interface ModelImageResizeOptions {\n\tmaxWidth?: number;\n\tmaxHeight?: number;\n\t/** Maximum base64-encoded payload size in bytes. */\n\tmaxBytes?: number;\n\tjpegQuality?: number;\n}\n\nexport interface ModelImageInputLimits {\n\t/** Cache-safe resize profile applied before a new image enters conversation history. */\n\tresize?: ModelImageResizeOptions;\n\t/** Maximum images accepted in one provider message. */\n\tmaxPerMessage?: number;\n\t/** Maximum images accepted across one provider request. */\n\tmaxPerRequest?: number;\n}\n\nexport interface ModelInputLimits {\n\t/** Maximum serialized provider request size in bytes. */\n\tmaxRequestBytes?: number;\n\timages?: ModelImageInputLimits;\n}\n\n/** Service tiers a model can advertise beyond standard processing. */\nexport type ModelServiceTierId = \"priority\" | \"ultrafast\";\n\n/**\n * A service tier a model advertises, following Codex's `ModelInfo.service_tiers`, with the provider's\n * published per-million-token rates for that tier.\n *\n * Adapters send a tier only when the model advertises it. `flex` is an API request option and needs\n * no advertisement.\n */\nexport interface ModelServiceTier {\n\tid: ModelServiceTierId;\n\tcost: ModelCost;\n}\n\n/**\n * Explicit routing metadata that marks a model as the fast-inference variant of another model.\n *\n * Presence of this field — never a `-fast` name suffix — is what gives a model fast semantics.\n * A provider, `models.json` custom model, or extension may own an exact `<base>-fast` ID without\n * this metadata, in which case it is an ordinary model and routes exactly as it is declared.\n */\nexport interface ModelFastRoute {\n\t/** Canonical ID of the normal-speed model this variant pairs with, in the same provider. */\n\tbaseModelId: string;\n\t/** Model ID to send upstream. OpenAI-style routing keeps the base ID; a provider with real fast siblings sends its own ID. */\n\tupstreamModelId: string;\n\t/** Service tier to send with the request. Set only for providers that route fast traffic through an OpenAI-style tier. */\n\tserviceTier?: ModelServiceTierId;\n\t/** Anthropic inference speed to send with the request. Set only for Claude models that support fast mode. */\n\tspeed?: \"fast\";\n}\n\n/** Fields shared by every catalog entry, regardless of what you can do with it. */\nexport interface BaseModel<TApi extends string> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: ProviderId;\n\tbaseUrl: string;\n\tinput: (\"text\" | \"image\" | \"pdf\")[];\n\t/** Provider input limits and cache-safe preprocessing metadata. */\n\tinputLimits?: ModelInputLimits;\n\tcost: ModelCost;\n\theaders?: Record<string, string>;\n}\n\n/** Chat model: usable with `stream()` and friends. */\nexport interface Model<TApi extends Api> extends BaseModel<TApi> {\n\t/**\n\t * Optional: chat is the default model type, so models without `type` are chat\n\t * models. Narrow mixed model lists with `isModelType()` instead of comparing\n\t * `type` directly.\n\t */\n\ttype?: \"chat\";\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * Missing keys use provider defaults. null marks a level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\t/** Prompt cache lifetimes per retention tier. Unset when the provider's cache behavior is unknown. */\n\tpromptCache?: ModelPromptCache;\n\tcontextWindow: number;\n\tmaxTokens: number;\n\t/** Default sampling parameters for this model. See {@link StreamOptions.samplingParams}; per-request keys override these. */\n\tsamplingParams?: Record<string, unknown>;\n\t/**\n\t * Marks this model as the fast-inference variant of {@link ModelFastRoute.baseModelId} and carries the\n\t * upstream routing it needs. Absent on every normal model.\n\t */\n\tfastRoute?: ModelFastRoute;\n\t/**\n\t * Service tiers this model advertises. When set, the Codex adapter sends only advertised tiers.\n\t * When unset, the model carries no tier metadata and only Ultrafast is withheld.\n\t */\n\tserviceTiers?: ModelServiceTier[];\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\" | \"azure-openai-responses\" | \"openai-codex-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: TApi extends \"bedrock-converse-stream\"\n\t\t\t\t\t? BedrockCompat\n\t\t\t\t\t: TApi extends \"mistral-conversations\"\n\t\t\t\t\t\t? MistralConversationsCompat\n\t\t\t\t\t\t: never;\n}\n\n/** Image-generation model: usable with `generateImages()` only. */\nexport interface ImageModel<TApi extends ImageApi> extends BaseModel<TApi> {\n\ttype: \"image\";\n\t/** Output modalities. Always includes `\"image\"`; `\"text\"` means the model can also return text blocks. */\n\toutput: (\"text\" | \"image\")[];\n}\n\n/** Structured classifier model: usable with `classify()` only. */\nexport interface ClassifierModel<TApi extends ClassifierApi> extends BaseModel<TApi> {\n\ttype: \"classifier\";\n\tcontextWindow: number;\n}\n\n/** Model shape for each model type. */\nexport interface ModelTypeMap {\n\tchat: Model<Api>;\n\timage: ImageModel<ImageApi>;\n\tclassifier: ClassifierModel<ClassifierApi>;\n}\n\n/** What a catalog entry is for. Decides which `Models` operation accepts it. */\nexport type ModelType = keyof ModelTypeMap;\n\n/** Anything a provider can list. Narrow with `isModelType()`. */\nexport type AnyModel = ModelTypeMap[ModelType];\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TelemetryContext } from \"@earendil-works/pi-telemetry\";\nimport type { AnthropicOptions } from \"./api/anthropic-messages.ts\";\nimport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nimport type { BedrockOptions } from \"./api/bedrock-converse-stream.ts\";\nimport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nimport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nimport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nimport type { OpenAICodexResponsesOptions } from \"./api/openai-codex-responses.ts\";\nimport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nimport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nimport type { PiMessagesOptions } from \"./api/pi-messages.ts\";\nimport type { AssistantMessageDiagnostic } from \"./utils/diagnostics.ts\";\nimport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type { AssistantMessageEventStream } from \"./utils/event-stream.ts\";\n\nexport type KnownApi =\n\t| \"openai-completions\"\n\t| \"mistral-conversations\"\n\t| \"openai-responses\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex-responses\"\n\t| \"anthropic-messages\"\n\t| \"bedrock-converse-stream\"\n\t| \"google-generative-ai\"\n\t| \"google-vertex\"\n\t| \"pi-messages\";\n\nexport type Api = KnownApi | (string & {});\n\nexport type KnownImageApi = \"openrouter-images\";\n\nexport type ImageApi = KnownImageApi | (string & {});\n\nexport type KnownClassifierApi = \"typesafe-system-one\" | \"cloudflare-workers-ai-system-one\" | \"llama-cpp-classify\";\n\nexport type ClassifierApi = KnownClassifierApi | (string & {});\n\nexport type KnownProvider =\n\t| \"amazon-bedrock\"\n\t| \"ant-ling\"\n\t| \"anthropic\"\n\t| \"google\"\n\t| \"google-vertex\"\n\t| \"openai\"\n\t| \"azure-openai-responses\"\n\t| \"openai-codex\"\n\t| \"radius\"\n\t| \"typesafe\"\n\t| \"nvidia\"\n\t| \"deepseek\"\n\t| \"github-copilot\"\n\t| \"xai\"\n\t| \"groq\"\n\t| \"cerebras\"\n\t| \"openrouter\"\n\t| \"vercel-ai-gateway\"\n\t| \"zai\"\n\t| \"zai-coding-cn\"\n\t| \"mistral\"\n\t| \"minimax\"\n\t| \"minimax-cn\"\n\t| \"moonshotai\"\n\t| \"moonshotai-cn\"\n\t| \"huggingface\"\n\t| \"fireworks\"\n\t| \"together\"\n\t| \"baseten\"\n\t| \"opencode\"\n\t| \"opencode-go\"\n\t| \"kimi-coding\"\n\t| \"meta\"\n\t| \"cloudflare-workers-ai\"\n\t| \"cloudflare-ai-gateway\"\n\t| \"qwen-token-plan\"\n\t| \"qwen-token-plan-cn\"\n\t| \"qwen-token-plan-individual\"\n\t| \"xiaomi\"\n\t| \"xiaomi-token-plan-cn\"\n\t| \"xiaomi-token-plan-ams\"\n\t| \"xiaomi-token-plan-sgp\";\nexport type ProviderId = KnownProvider | string;\n\nexport type ToolChoice = \"auto\" | \"none\";\nexport type ThinkingLevel = \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type ModelThinkingLevel = \"off\" | ThinkingLevel;\nexport type ThinkingLevelMap = Partial<Record<ModelThinkingLevel, string | null>>;\nexport type SamplingParams = Record<string, unknown>;\nexport type SamplingParamsByThinkingLevel = Partial<Record<ModelThinkingLevel, SamplingParams>>;\nexport type ChatTemplateKwargValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| {\n\t\t\t$var: \"thinking.enabled\" | \"thinking.effort\" | \"thinking.budget\";\n\t\t\tomitWhenOff?: boolean;\n\t };\n\n/** Top-level request field used to cap reasoning tokens on OpenAI-compatible servers. */\nexport type ThinkingTokenBudgetField = \"thinking_token_budget\" | \"thinking_budget\" | \"thinking_budget_tokens\";\n\n/** Token budgets for each thinking level (token-based providers only) */\nexport interface ThinkingBudgets {\n\tminimal?: number;\n\tlow?: number;\n\tmedium?: number;\n\thigh?: number;\n}\n\n// Base options all providers share\nexport type CacheRetention = \"none\" | \"short\" | \"long\";\n\n/**\n * Best-effort prompt cache lifetime in seconds for each retention tier a request can ask for.\n * A missing tier means the lifetime is unknown; pi does not warm such caches.\n */\nexport type ModelPromptCache = Partial<Record<Exclude<CacheRetention, \"none\">, number>>;\n\nexport type Transport = \"sse\" | \"websocket\" | \"websocket-cached\" | \"auto\";\n\n/** Provider-scoped environment overrides. Values take precedence over process.env. */\nexport type ProviderEnv = Record<string, string>;\nexport type ProviderHeaders = Record<string, string | null>;\nexport type FetchFunction = typeof globalThis.fetch;\nexport type SessionAffinityFormat = \"openai\" | \"openai-nosession\" | \"openrouter\";\n\nexport interface ProviderResponse {\n\tstatus: number;\n\theaders: Record<string, string>;\n}\n\n/** Authentication, HTTP transport, and lifecycle callbacks shared by provider requests. */\nexport interface ProviderRequestOptions<TModel = Model<Api>> {\n\tsignal?: AbortSignal;\n\t/** Explicit parent context for telemetry produced by this logical request. */\n\ttelemetryContext?: TelemetryContext;\n\tapiKey?: string;\n\t/**\n\t * Optional fetch implementation for provider HTTP requests.\n\t * Defaults to `globalThis.fetch`. Provider adapters that cannot inject a custom implementation may reject it.\n\t * This does not affect WebSocket transports.\n\t */\n\tfetch?: FetchFunction;\n\t/**\n\t * Provider-scoped environment values. These take precedence over process.env for\n\t * provider configuration such as regional settings, endpoint placeholders, and\n\t * proxy variables.\n\t */\n\tenv?: ProviderEnv;\n\t/**\n\t * Optional callback for inspecting or replacing provider payloads before sending.\n\t * Return undefined to keep the payload unchanged.\n\t */\n\tonPayload?: (payload: unknown, model: TModel) => unknown | undefined | Promise<unknown | undefined>;\n\t/**\n\t * Optional callback invoked after an HTTP response is received.\n\t */\n\tonResponse?: (response: ProviderResponse, model: TModel) => void | Promise<void>;\n\t/**\n\t * Optional custom HTTP headers to include in API requests.\n\t * Merged with provider defaults; caller values override default headers.\n\t * On AWS Bedrock these are injected via a Smithy `build`-step middleware so\n\t * they are covered by SigV4 signing; reserved headers (`x-amz-*`,\n\t * `authorization`, `host`) are silently ignored to preserve SigV4 / bearer auth.\n\t * A null value suppresses a provider/API default header with the same name.\n\t */\n\theaders?: ProviderHeaders;\n\t/**\n\t * HTTP request timeout in milliseconds for providers/SDKs that support it.\n\t * For example, OpenAI and Anthropic SDK clients default to 10 minutes.\n\t */\n\ttimeoutMs?: number;\n\t/**\n\t * Maximum retry attempts for providers/SDKs that support client-side retries.\n\t * For example, OpenAI and Anthropic SDK clients default to 2.\n\t */\n\tmaxRetries?: number;\n\t/**\n\t * Maximum delay in milliseconds to wait for a retry when the server requests a long wait.\n\t * If the server's requested delay exceeds this value, the request fails immediately\n\t * with an error containing the requested delay, allowing higher-level retry logic\n\t * to handle it with user visibility.\n\t * Default: 60000 (60 seconds). Set to 0 to disable the cap.\n\t */\n\tmaxRetryDelayMs?: number;\n}\n\nexport interface StreamOptions extends ProviderRequestOptions<Model<Api>> {\n\t/**\n\t * Optional callback invoked after an HTTP response is received and before\n\t * its body stream is consumed.\n\t */\n\tonResponse?: (response: ProviderResponse, model: Model<Api>) => void | Promise<void>;\n\t/**\n\t * Optional observer for each parsed provider stream event before Pi normalization.\n\t * Event data is adapter-owned and must be treated as read-only.\n\t * Adapter support is explicit; unsupported adapters do not invoke it.\n\t */\n\tonProviderStreamEvent?: (data: unknown, model: Model<Api>) => void | Promise<void>;\n\ttemperature?: number;\n\t/**\n\t * Arbitrary sampling parameters merged into the request body as-is, after the named request\n\t * fields, so keys here override them. Lets custom OpenAI-compatible servers (llama.cpp, vLLM,\n\t * SGLang, ...) receive parameters pi does not model, e.g. `top_p`, `top_k`, `min_p`,\n\t * `repetition_penalty`. Merged over `Model.samplingParams` per key. Only applied by\n\t * OpenAI-compatible adapters (completions, responses, Azure responses); other APIs ignore it.\n\t */\n\tsamplingParams?: SamplingParams;\n\tmaxTokens?: number;\n\t/**\n\t * Preferred transport for providers that support multiple transports.\n\t * Providers that do not support this option ignore it.\n\t */\n\ttransport?: Transport;\n\t/**\n\t * Prompt cache retention preference. Providers map this to their supported values.\n\t * Default: \"short\".\n\t */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Optional session identifier for providers that support session-based caching.\n\t * Providers can use this to enable prompt caching, request routing, or other\n\t * session-aware features. Ignored by providers that don't support it.\n\t */\n\tsessionId?: string;\n\t/**\n\t * WebSocket connect timeout in milliseconds for providers that support\n\t * WebSocket transports. This covers the connection/open handshake only;\n\t * HTTP/SDK idleness uses `timeoutMs`, while gaps between decoded provider\n\t * stream events use `streamDeadlineMs`.\n\t */\n\twebsocketConnectTimeoutMs?: number;\n\t/**\n\t * Maximum idle gap in milliseconds between two provider stream events.\n\t *\n\t * Enforced below the HTTP layer, so a response body that stalls without ever\n\t * rejecting the adapter's async iterator (for example a decompression failure\n\t * that destroys the stream silently, #2553) still settles the attempt as a\n\t * retryable transport error instead of hanging forever. The timer restarts on\n\t * every event, so it never caps total stream duration.\n\t *\n\t * Defaults to 300000 ms. `0` (or any non-positive value) disables it.\n\t */\n\tstreamDeadlineMs?: number;\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t * For example, Anthropic uses `user_id` for abuse tracking and rate limiting.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderStreamOptions = StreamOptions & Record<string, unknown>;\n\nexport interface DeferredFetchOptions extends ProviderRequestOptions<Model<Api>> {\n\t/**\n\t * Maximum provider long-poll duration in milliseconds.\n\t * Defaults to 0, which performs one status check.\n\t */\n\twait?: number;\n}\n\n/** Request options for best-effort deferred-response cancellation. */\nexport type DeferredCancelOptions = ProviderRequestOptions<Model<Api>>;\n\n/**\n * Maps known APIs to their full provider-specific stream option types.\n * Type-only imports from API implementation modules are erased at emit, so\n * this is tree-shake safe.\n */\nexport interface ApiOptionsMap {\n\t\"anthropic-messages\": AnthropicOptions;\n\t\"openai-completions\": OpenAICompletionsOptions;\n\t\"openai-responses\": OpenAIResponsesOptions;\n\t\"openai-codex-responses\": OpenAICodexResponsesOptions;\n\t\"azure-openai-responses\": AzureOpenAIResponsesOptions;\n\t\"google-generative-ai\": GoogleOptions;\n\t\"google-vertex\": GoogleVertexOptions;\n\t\"mistral-conversations\": MistralOptions;\n\t\"bedrock-converse-stream\": BedrockOptions;\n\t\"pi-messages\": PiMessagesOptions;\n}\n\n/**\n * Full stream options for an API. Known APIs resolve to their concrete option\n * type; custom API strings fall back to the generic shape.\n */\nexport type ApiStreamOptions<TApi extends Api> = TApi extends keyof ApiOptionsMap\n\t? ApiOptionsMap[TApi]\n\t: StreamOptions & Record<string, unknown>;\n\n/**\n * The uniform stream contract of an API implementation module: every module\n * under `src/api/` exports `stream` and `streamSimple`; capable modules may also\n * export deferred-response methods. Lazy wrappers (`lazyApi()`) and provider\n * factories pass these around as values. This is the untyped dispatch shape;\n * per-API option typing lives on the implementation modules themselves and on\n * `Provider.stream()` via `ApiStreamOptions`.\n */\nexport interface ProviderStreams {\n\tstream(model: Model<Api>, context: TranscriptContext, options?: StreamOptions): AssistantMessageEventStream;\n\tstreamSimple(\n\t\tmodel: Model<Api>,\n\t\tcontext: TranscriptContext,\n\t\toptions?: SimpleStreamOptions,\n\t): AssistantMessageEventStream;\n\tfetchDeferred?(\n\t\tmodel: Model<Api>,\n\t\thandle: DeferredHandle,\n\t\toptions?: DeferredFetchOptions,\n\t): AssistantMessageEventStream;\n\tcancelDeferred?(model: Model<Api>, handle: DeferredHandle, options?: DeferredCancelOptions): Promise<void>;\n}\n\n/**\n * The uniform contract of an image-generation API implementation module:\n * every image API module under `src/api/` exports exactly `generateImages`,\n * so the module itself satisfies this interface. Lazy wrappers and\n * `createProvider({ images })` pass these around as values.\n */\nexport interface ProviderImages {\n\tgenerateImages(\n\t\tmodel: ImageModel<ImageApi>,\n\t\tcontext: ImagesContext,\n\t\toptions?: ImagesOptions,\n\t): Promise<AssistantImages>;\n}\n\n/** The uniform contract implemented by classifier API modules. */\nexport interface ProviderClassifier {\n\tclassify(\n\t\tmodel: ClassifierModel<ClassifierApi>,\n\t\tcontext: ClassifierContext,\n\t\toptions?: ClassifierOptions,\n\t): Promise<ClassifierResult>;\n}\n\nexport interface ClassifierOptions extends ProviderRequestOptions<ClassifierModel<ClassifierApi>> {\n\t/**\n\t * Divides the answer logits by this value before they are normalized into probabilities.\n\t * Values above 1 soften the distribution; values below 1 sharpen it. Must be positive.\n\t * APIs that cannot apply it ignore it.\n\t */\n\ttemperature?: number;\n}\n\nexport interface ImagesOptions extends ProviderRequestOptions<ImageModel<ImageApi>> {\n\t/**\n\t * Optional metadata to include in API requests.\n\t * Providers extract the fields they understand and ignore the rest.\n\t */\n\tmetadata?: Record<string, unknown>;\n}\n\nexport type ProviderImagesOptions = ImagesOptions & Record<string, unknown>;\n\nexport interface AnthropicAllowedFallbackModel {\n\tprovider: ProviderId;\n\tmodel: string;\n\tcost: ModelCost;\n}\n\n// Unified options with reasoning passed to streamSimple() and completeSimple()\nexport interface SimpleStreamOptions extends StreamOptions {\n\t/** Provider-neutral tool selection for simple requests. When omitted, adapters use provider-specific behavior. */\n\ttoolChoice?: ToolChoice;\n\treasoning?: ThinkingLevel;\n\t/** Ask a capable provider to return a durable handle and continue the request asynchronously. */\n\tdeferred?: boolean | { window?: \"15m\" | \"1h\" | \"24h\" };\n\t/** Custom token budgets for thinking levels (token-based providers only) */\n\tthinkingBudgets?: ThinkingBudgets;\n}\n\n// Generic StreamFunction with typed options.\n//\n// Contract:\n// - Receives a normalized transcript: the system prompt and tools live in the\n// leading system message, never on the context itself.\n// - Must return an AssistantMessageEventStream.\n// - Direct streamSimple() calls may throw synchronously when request auth is\n// missing. Once a stream is returned, request/model/runtime failures should\n// be encoded in the stream, not thrown.\n// - Error termination must produce an AssistantMessage with stopReason\n// \"error\" or \"aborted\" and errorMessage, emitted via the stream protocol.\nexport type StreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = StreamOptions> = (\n\tmodel: Model<TApi>,\n\tcontext: TranscriptContext,\n\toptions?: TOptions,\n) => AssistantMessageEventStream;\n\nexport type ImagesFunction<TOptions extends ImagesOptions = ImagesOptions> = (\n\tmodel: ImageModel<ImageApi>,\n\tcontext: ImagesContext,\n\toptions?: TOptions,\n) => Promise<AssistantImages>;\n\nexport type ClassifierFunction<TOptions extends ClassifierOptions = ClassifierOptions> = (\n\tmodel: ClassifierModel<ClassifierApi>,\n\tcontext: ClassifierContext,\n\toptions?: TOptions,\n) => Promise<ClassifierResult>;\n\nexport interface TextSignatureV1 {\n\tv: 1;\n\tid: string;\n\tphase?: \"commentary\" | \"final_answer\";\n}\n\nexport interface TextContent {\n\ttype: \"text\";\n\ttext: string;\n\ttextSignature?: string; // e.g., for OpenAI responses, message metadata (legacy id string or TextSignatureV1 JSON)\n}\n\nexport interface ThinkingContent {\n\ttype: \"thinking\";\n\tthinking: string;\n\tthinkingSignature?: string; // Provider-specific opaque or serialized reasoning replay data\n\t/** When true, the thinking content was redacted by safety filters. The opaque\n\t * encrypted payload is stored in `thinkingSignature` so it can be passed back\n\t * to the API for multi-turn continuity. */\n\tredacted?: boolean;\n}\n\n/**\n * Boundary marker emitted by Anthropic server-side fallback, where one model's output gives way\n * to the next after a classifier refusal.\n *\n * This is public content rather than a stream-only event because it must survive the round trip:\n * \"Keep it exactly where it appeared. The API uses its position to validate the thinking blocks\n * around it, so a request that echoes thinking blocks from both sides of the boundary is rejected\n * if the block is omitted or moved.\"\n * https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback\n */\nexport interface FallbackContent {\n\ttype: \"fallback\";\n\t/** The model that declined. Echoes the model string sent when the declining hop is the request's own model. */\n\tfromModel: string;\n\t/** Resolved id of the model that continues. Always present. */\n\ttoModel: string;\n}\n\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\"\n}\n\n/**\n * A document sent as model input, currently PDF only.\n *\n * Anthropic documents PDF as a platform capability — \"All active models support PDF processing\" —\n * routed through the same vision path as images, so it is not a per-model modality. A model\n * advertises it through `Model.input` containing `\"pdf\"`, which generated metadata sets only for\n * the runtimes that can actually serialize a document block. Providers that cannot are sent a\n * visible placeholder instead, exactly as they are for images they cannot accept.\n * https://platform.claude.com/docs/en/build-with-claude/pdf-support\n */\nexport interface DocumentContent {\n\ttype: \"document\";\n\t/** Base64-encoded document bytes. Amazon Bedrock takes raw bytes and decodes this itself. */\n\tdata: string;\n\t/**\n\t * The only media type either serializer implements. It is a literal rather than `string`\n\t * because both paths hardcode PDF — the Anthropic block emits `BetaBase64PDFSource`, whose\n\t * `media_type` is itself a fixed literal, and Bedrock emits `DocumentFormat.PDF` — so a wider\n\t * type would let a caller label arbitrary bytes as a PDF. Widening this union later is\n\t * non-breaking; narrowing it after release would not be. Note that adding a format is not a\n\t * media-type swap on the Anthropic side: plain text needs a structurally different source\n\t * variant (`BetaPlainTextSource`, `type: \"text\"`), and Bedrock's `doc`/`docx`/`xls`/`xlsx`/\n\t * `csv`/`html`/`md` formats have no Anthropic source variant at all.\n\t */\n\tmimeType: \"application/pdf\";\n\t/**\n\t * Optional caller-supplied label. Amazon Bedrock requires a name and warns that it \"is\n\t * vulnerable to prompt injections\", so the Bedrock path sanitizes this to the characters AWS\n\t * permits and falls back to a neutral generated name.\n\t */\n\tname?: string;\n}\n\nexport interface ToolCall {\n\ttype: \"toolCall\";\n\tid: string;\n\tname: string;\n\targuments: JsonObject;\n\tthoughtSignature?: string; // Google-specific: opaque signature for reusing thought context\n\t/** OpenAI Responses namespace for calls to dynamically loaded or namespaced tools. */\n\tnamespace?: string;\n}\n\nexport interface Usage {\n\tinput: number;\n\toutput: number;\n\tcacheRead: number;\n\tcacheWrite: number;\n\t/** Subset of `cacheWrite` written with 1h retention. Anthropic and Bedrock report this split. */\n\tcacheWrite1h?: number;\n\t/**\n\t * Reasoning/thinking tokens, when the provider reports them. This is a subset of\n\t * `output`: `output` already includes these tokens. Set to a number (possibly 0) by\n\t * providers that expose a reasoning breakdown; left undefined by providers that don't.\n\t */\n\treasoning?: number;\n\ttotalTokens: number;\n\tcost: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n}\n\nexport type StopReason = \"pending\" | \"stop\" | \"length\" | \"toolUse\" | \"error\" | \"aborted\" | \"deferred\";\n\nexport type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject;\nexport type JsonObject = { [key: string]: JsonValue };\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype IsExactlyJsonValue<T> = [T] extends [JsonValue] ? ([JsonValue] extends [T] ? true : false) : false;\ntype IsJsonProperty<T> =\n\tIsAny<T> extends true\n\t\t? false\n\t\t: unknown extends T\n\t\t\t? false\n\t\t\t: [Exclude<T, undefined>] extends [never]\n\t\t\t\t? true\n\t\t\t\t: IsJsonCompatible<Exclude<T, undefined>>;\ntype InvalidJsonKeys<T extends object> = {\n\t[TKey in keyof T]-?: TKey extends string | number ? (IsJsonProperty<T[TKey]> extends true ? never : TKey) : TKey;\n}[keyof T];\ntype IsJsonCompatible<T> =\n\tIsAny<T> extends true\n\t\t? false\n\t\t: unknown extends T\n\t\t\t? false\n\t\t\t: IsExactlyJsonValue<T> extends true\n\t\t\t\t? true\n\t\t\t\t: T extends null | boolean | number | string\n\t\t\t\t\t? true\n\t\t\t\t\t: T extends undefined\n\t\t\t\t\t\t? false\n\t\t\t\t\t\t: T extends readonly (infer TItem)[]\n\t\t\t\t\t\t\t? IsJsonCompatible<TItem>\n\t\t\t\t\t\t\t: T extends (...args: never[]) => unknown\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: T extends object\n\t\t\t\t\t\t\t\t\t? [InvalidJsonKeys<T>] extends [never]\n\t\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t\t: false;\n\n/** The JSON representation of a typed in-memory value. Optional object properties remain optional. */\nexport type JsonRepresentation<T> =\n\tIsAny<T> extends true\n\t\t? JsonValue\n\t\t: unknown extends T\n\t\t\t? JsonValue\n\t\t\t: [T] extends [JsonValue]\n\t\t\t\t? T\n\t\t\t\t: T extends readonly unknown[]\n\t\t\t\t\t? { [TKey in keyof T]: JsonRepresentation<Exclude<T[TKey], undefined>> }\n\t\t\t\t\t: T extends object\n\t\t\t\t\t\t? { [TKey in keyof T]: JsonRepresentation<Exclude<T[TKey], undefined>> }\n\t\t\t\t\t\t: never;\n\nexport interface DeferredHandle {\n\tprovider: string;\n\tmodelId: string;\n\tapi: string;\n\t/** Provider token, such as a response id or batch id plus row id. */\n\tid: string;\n\texpiresAt?: number;\n\tpollAfterMs?: number;\n\t/** Provider conversion data required to reconstruct the final assistant message. */\n\tdata?: JsonValue;\n}\n\n/**\n * System instructions and tool declarations at one point in the transcript.\n *\n * The leading system message is the system prompt. Later system messages change it:\n * `content` adds instructions from that point on, `sections` replace or remove named\n * prompt sections, and `toolsAdded`/`toolsRemoved` change the tool set. Replaying\n * every system message in order yields the current prompt and tools. Providers that\n * accept system messages mid-conversation send each one in place; other providers\n * rebuild the leading system message from the replayed state.\n */\nexport interface SystemMessage {\n\trole: \"system\";\n\t/** Instruction text. On the leading message this is the base prompt; later, additional instructions. */\n\tcontent: string | TextContent[];\n\t/**\n\t * Named, ordered prompt sections rendered verbatim after `content`. The leading message\n\t * declares them; later messages replace sections by name, and `null` removes one. Keep\n\t * each section self-delimiting (a tag, a heading) so the model can relate an update to\n\t * the original. Avoid integer-like names; JSON objects reorder those.\n\t */\n\tsections?: Record<string, string | null>;\n\t/** Complete definitions of tools that become available at this point. */\n\ttoolsAdded?: Tool[];\n\t/** Tools that stop being available at this point. */\n\ttoolsRemoved?: ToolReference[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface UserMessage {\n\trole: \"user\";\n\tcontent: string | (TextContent | ImageContent | DocumentContent)[];\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface AssistantMessage {\n\trole: \"assistant\";\n\tcontent: (TextContent | ThinkingContent | ToolCall | FallbackContent)[];\n\tapi: Api;\n\tprovider: ProviderId;\n\tmodel: string;\n\tresponseModel?: string; // Concrete model reported by the provider when different from the requested `model`\n\tresponseId?: string; // Provider-specific response/message identifier when the upstream API exposes one\n\t/** Exact provider-native effort level used for this response. Absent for legacy or unmanaged responses. */\n\tproviderThinkingLevel?: string;\n\tdiagnostics?: AssistantMessageDiagnostic[]; // Redacted provider/runtime diagnostics for failures and recoveries.\n\tusage: Usage;\n\tstopReason: StopReason;\n\tdeferred?: DeferredHandle;\n\terrorMessage?: string;\n\trawStopReason?: string;\n\t/**\n\t * Provider indication of whether the model explicitly ended its turn.\n\t * Preserved for debugging and does not currently affect agent control flow.\n\t */\n\tendTurn?: boolean;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\n/** A tool call made by another tool, such as a codemode script. */\nexport interface NestedToolCallRecord {\n\tid: string;\n\tname: string;\n\t/** Omitted when over the size limits. */\n\targuments?: JsonObject;\n\t/** UTF-8 JSON size when arguments are omitted. */\n\targumentsBytes?: number;\n\tstatus: \"ok\" | \"error\" | \"unfinished\";\n\tdurationMs?: number;\n\terror?: string;\n}\n\n/** Bounded nested-call record. Results are not recorded. */\nexport interface NestedToolCalls {\n\tcalls: NestedToolCallRecord[];\n\tcomplete: boolean;\n}\n\nexport type ToolResultMessage<TDetails = JsonValue> =\n\tIsJsonCompatible<TDetails> extends true\n\t\t? {\n\t\t\t\trole: \"toolResult\";\n\t\t\t\ttoolCallId: string;\n\t\t\t\ttoolName: string;\n\t\t\t\tcontent: (TextContent | ImageContent)[]; // Supports text and images\n\t\t\t\tdetails?: JsonRepresentation<TDetails>;\n\t\t\t\t/** Usage from the tool execution itself, if available. Not part of main LLM context accounting. */\n\t\t\t\tusage?: Usage;\n\t\t\t\t/** Nested calls retained in the session, not sent to the model. */\n\t\t\t\tnestedCalls?: NestedToolCalls;\n\t\t\t\tisError: boolean;\n\t\t\t\ttimestamp: number; // Unix timestamp in milliseconds\n\t\t\t}\n\t\t: never;\n\nexport type Message = SystemMessage | UserMessage | AssistantMessage | ToolResultMessage;\n\nexport type ImagesInputContent = TextContent | ImageContent;\nexport type ImagesOutputContent = TextContent | ImageContent;\n\nexport interface ImagesContext {\n\tinput: ImagesInputContent[];\n}\n\nexport type ImagesStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface AssistantImages {\n\tapi: ImageApi;\n\tprovider: ProviderId;\n\tmodel: string;\n\toutput: ImagesOutputContent[];\n\tresponseId?: string;\n\tusage?: Usage;\n\tstopReason: ImagesStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nexport interface ClassifierChoiceQuestion {\n\ttype: \"choice\";\n\tinstructions: string;\n\tcriteria: Record<string, string>;\n}\n\nexport interface ClassifierScoreQuestion {\n\ttype: \"score\";\n\tinstructions: string;\n\tcriteria: string[];\n}\n\nexport interface ClassifierBoolQuestion {\n\ttype: \"bool\";\n\tinstructions: string;\n\tcriteria: { true: string; false: string };\n}\n\nexport type ClassifierQuestion = ClassifierChoiceQuestion | ClassifierScoreQuestion | ClassifierBoolQuestion;\n\nexport interface ClassifierContext {\n\tstate: JsonObject;\n\tquestions: Record<string, ClassifierQuestion>;\n}\n\nexport interface ClassifierChoiceAnswer {\n\ttype: \"choice\";\n\tchoice: string;\n\tprobabilities: Record<string, number>;\n\tconfidence: number;\n}\n\nexport interface ClassifierScoreAnswer {\n\ttype: \"score\";\n\tscore: number;\n\tconfidence: number;\n}\n\nexport interface ClassifierBoolAnswer {\n\ttype: \"bool\";\n\tprobability: number;\n}\n\nexport type ClassifierAnswer = ClassifierChoiceAnswer | ClassifierScoreAnswer | ClassifierBoolAnswer;\nexport type ClassifierStopReason = \"stop\" | \"error\" | \"aborted\";\n\nexport interface ClassifierResult {\n\tapi: ClassifierApi;\n\tprovider: ProviderId;\n\tmodel: string;\n\tanswers: Record<string, ClassifierAnswer>;\n\t/** Token usage and cost at the model's catalog price, when reported. */\n\tusage?: Usage;\n\tstopReason: ClassifierStopReason;\n\terrorMessage?: string;\n\ttimestamp: number; // Unix timestamp in milliseconds\n}\n\nimport type { TSchema } from \"typebox\";\n\n/** OpenAI grammar variants for constrained sampling. */\nexport type GrammarFormat = \"openai_lark\" | \"openai_regex\";\n\nexport type GrammarVariants = Partial<Record<GrammarFormat, string>>;\n\n/**\n * Optional provider-side constrained sampling configs for a tool.\n *\n * The `json_schema` value roughly maps to the concept of `strict` in APIs which is\n * implemented as json-schema constrained sampling by APIs. Grammar variants let\n * callers provide provider-specific encodings of the same intended language.\n */\nexport type ConstrainedSamplingConfig =\n\t| {\n\t\t\ttype: \"json_schema\";\n\t\t\tstrict: \"prefer\" | \"require\";\n\t }\n\t| {\n\t\t\ttype: \"grammar\";\n\t\t\tvariants: GrammarVariants;\n\t };\n\nexport interface Tool<TParameters extends TSchema = TSchema> {\n\tname: string;\n\tdescription: string;\n\tparameters: TParameters;\n\tconstrainedSampling?: false | ConstrainedSamplingConfig;\n}\n\nexport interface ToolReference {\n\tname: string;\n}\n\n/**\n * Request input accepted by the public stream entry points (`Models.stream()`,\n * `streamSimple()`, ...). `systemPrompt` and `tools` are shorthand for a leading\n * system message; `normalizeContext()` folds them into one before the request\n * reaches a provider.\n */\nexport interface Context {\n\tsystemPrompt?: string;\n\tmessages: Message[];\n\ttools?: Tool[];\n}\n\ndeclare const transcriptContextBrand: unique symbol;\n\n/**\n * Normalized request context passed to providers and API implementations. The\n * prompt and tool declarations are carried by the transcript's system messages.\n * Only `normalizeContext()` produces this type, so a raw `Context` cannot reach\n * provider code by accident.\n */\nexport type TranscriptContext = {\n\tmessages: Message[];\n\treadonly [transcriptContextBrand]: true;\n};\n\n/**\n * Event protocol for AssistantMessageEventStream.\n *\n * Successful streams emit `start` before partial updates and terminate with\n * `done`. A stream may terminate directly with `error` when request setup fails\n * before generation starts; after `start`, failures also terminate with `error`.\n * Direct `streamSimple()` calls throw synchronously when request auth is missing.\n * Updates and `done` must never appear before `start`.\n *\n * Tool-call arguments at `toolcall_start` are provider-specific;\n * `toolcall_delta` carries subsequent JSON updates.\n */\nexport type AssistantMessageEvent =\n\t| { type: \"start\"; partial: AssistantMessage }\n\t| { type: \"text_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"text_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"text_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"thinking_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"thinking_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"thinking_end\"; contentIndex: number; content: string; partial: AssistantMessage }\n\t| { type: \"toolcall_start\"; contentIndex: number; partial: AssistantMessage }\n\t| { type: \"toolcall_delta\"; contentIndex: number; delta: string; partial: AssistantMessage }\n\t| { type: \"toolcall_end\"; contentIndex: number; toolCall: ToolCall; partial: AssistantMessage }\n\t| {\n\t\t\ttype: \"done\";\n\t\t\treason: Extract<StopReason, \"stop\" | \"length\" | \"toolUse\" | \"deferred\">;\n\t\t\tmessage: AssistantMessage;\n\t }\n\t| { type: \"error\"; reason: Extract<StopReason, \"aborted\" | \"error\">; error: AssistantMessage };\n\n/**\n * Compatibility settings for OpenAI-compatible completions APIs.\n * Use this to override URL-based auto-detection for custom providers.\n */\nexport interface OpenAICompletionsCompat {\n\t/** Whether the provider supports the `store` field. Default: auto-detected from URL. */\n\tsupportsStore?: boolean;\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: auto-detected from URL. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */\n\tsupportsReasoningEffort?: boolean;\n\t/**\n\t * Whether the model accepts the `temperature` request field. Claude Fable 5.1 rejects\n\t * non-default `temperature`, `top_p`, and `top_k` on every request, and OpenRouter's own\n\t * `supported_parameters` for that model omits `temperature`. When false, the provider\n\t * omits `temperature` and also strips `temperature`, `top_p`, and `top_k` from\n\t * `samplingParams`, which is otherwise merged last and would reopen them.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`tool_choice` `\"required\"` or\n\t * `{ type: \"function\", ... }`). Claude Fable 5.1 rejects it on every request, whichever\n\t * platform serves the model. When false, the provider rejects a forced choice with an error\n\t * rather than sending a request the model cannot honor. `\"auto\"` and `\"none\"` are never\n\t * altered. https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */\n\tsupportsUsageInStreaming?: boolean;\n\t/** Whether streamed responses include `finish_reason`. When false, pi infers `stop` or `toolUse` when the stream ends. Default: true. */\n\tsupportsFinishReason?: boolean;\n\t/** Which field to use for max tokens. Default: auto-detected from URL. */\n\tmaxTokensField?: \"max_completion_tokens\" | \"max_tokens\";\n\t/** Whether tool results require the `name` field. Default: auto-detected from URL. */\n\trequiresToolResultName?: boolean;\n\t/** Whether a user message after tool results requires an assistant message in between. Default: auto-detected from URL. */\n\trequiresAssistantAfterToolResult?: boolean;\n\t/** Whether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL. */\n\trequiresThinkingAsText?: boolean;\n\t/** Whether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL. */\n\trequiresReasoningContentOnAssistantMessages?: boolean;\n\t/** Format for reasoning/thinking parameter. \"openai\" uses reasoning_effort, \"openrouter\" uses reasoning: { effort }, \"deepseek\" uses thinking: { type } plus reasoning_effort when supported, \"together\" uses reasoning: { enabled } plus reasoning_effort when supported, \"baseten\" uses configurable chat_template_args plus reasoning_effort when supported, \"zai\" uses thinking: { type }, \"qwen\" uses top-level enable_thinking: boolean, \"qwen-chat-template\" uses chat_template_kwargs.enable_thinking and preserve_thinking, \"chat-template\" uses configurable chat_template_kwargs, \"string-thinking\" uses top-level thinking: string, and \"ant-ling\" uses reasoning: { effort } only when the mapped effort is non-null. Default: \"openai\". */\n\tthinkingFormat?:\n\t\t| \"openai\"\n\t\t| \"openrouter\"\n\t\t| \"deepseek\"\n\t\t| \"together\"\n\t\t| \"baseten\"\n\t\t| \"zai\"\n\t\t| \"qwen\"\n\t\t| \"chat-template\"\n\t\t| \"qwen-chat-template\"\n\t\t| \"string-thinking\"\n\t\t| \"ant-ling\";\n\t/** Kwargs to send as `chat_template_kwargs` when `thinkingFormat` is `chat-template`. Use `{ \"$var\": \"thinking.enabled\" }`, `{ \"$var\": \"thinking.effort\" }`, or `{ \"$var\": \"thinking.budget\" }` for pi-controlled thinking values. */\n\tchatTemplateKwargs?: Record<string, ChatTemplateKwargValue>;\n\t/** Arguments to send as `chat_template_args` when `thinkingFormat` is `baseten`. Use `{ \"$var\": \"thinking.enabled\" }`, `{ \"$var\": \"thinking.effort\" }`, or `{ \"$var\": \"thinking.budget\" }` for pi-controlled thinking values. */\n\tchatTemplateArgs?: Record<string, ChatTemplateKwargValue>;\n\t/** OpenRouter-compatible routing preferences sent as the `provider` request field. */\n\topenRouterRouting?: OpenRouterRouting;\n\t/** Vercel AI Gateway routing preferences. Only used when baseUrl points to Vercel AI Gateway. */\n\tvercelGatewayRouting?: VercelGatewayRouting;\n\t/** Whether z.ai supports top-level `tool_stream: true` for streaming tool call deltas. Default: false. */\n\tzaiToolStream?: boolean;\n\t/**\n\t * Top-level request field used to cap reasoning tokens from `thinkingBudgets`.\n\t * Reasoning and the answer share `max_tokens` on these endpoints, so without a budget a\n\t * reasoning-heavy turn can consume the whole response and emit no answer.\n\t * `\"thinking_token_budget\"` is vLLM, `\"thinking_budget\"` is Qwen/DashScope/SGLang,\n\t * `\"thinking_budget_tokens\"` is llama.cpp. Off by default; not set on the generated catalog.\n\t */\n\tthinkingTokenBudgetField?: ThinkingTokenBudgetField;\n\t/** Alias for `thinkingTokenBudgetField: \"thinking_token_budget\"` (vLLM). Prefer `thinkingTokenBudgetField`. Default: false. */\n\tsupportsThinkingTokenBudget?: boolean;\n\t/** Whether the provider supports OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false; the generated model catalog enables it for verified models. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Whether system messages can introduce additional tools mid-conversation. Requires `supportsMidConvoSystemMessages`. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsMidConvoToolAdditions?: boolean;\n\t/** Whether the provider supports the `strict` field in tool definitions. Default: false; generated capable models enable it explicitly. */\n\tsupportsStrictMode?: boolean;\n\t/** Cache control convention for prompt caching. \"anthropic\" applies Anthropic-style `cache_control` markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content. */\n\tcacheControlFormat?: \"anthropic\";\n\t/** Whether to send session-affinity data from `options.sessionId`. Default: true for OpenRouter endpoints, false otherwise. */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id`, `x-client-request-id`, and `x-session-affinity`; `openai-nosession` sends `x-client-request-id` and `x-session-affinity`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention (`prompt_cache_retention: \"24h\"` or Anthropic-style `cache_control.ttl: \"1h\"`, depending on format). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * vLLM scheduler priority sent as the top-level `priority` request field (lower values are\n\t * handled earlier; server default 0). Only meaningful when vLLM runs with\n\t * `--scheduling-policy priority`; useful for keeping background/batch work from stalling\n\t * interactive sessions. Off by default; not set on the generated catalog.\n\t */\n\tvllmPriority?: number;\n}\n\n/** Compatibility settings for OpenAI Responses APIs. */\nexport interface OpenAIResponsesCompat {\n\t/** Whether the provider supports the `developer` role (vs `system`). Default: true. */\n\tsupportsDeveloperRole?: boolean;\n\t/** Whether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false; the generated model catalog enables it for verified models. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Session-affinity header format: `openai` sends `session_id` and `x-client-request-id`; `openai-nosession` sends `x-client-request-id`; `openrouter` sends `x-session-id`. Does not affect the `prompt_cache_key` body param, which is governed by cache retention. Default: auto-detected. */\n\tsessionAffinityFormat?: SessionAffinityFormat;\n\t/** Whether the provider supports long prompt cache retention. This uses `prompt_cache_options.ttl: \"30m\"` on GPT-5.6+ and `prompt_cache_retention: \"24h\"` on earlier models. Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/** Whether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly. */\n\tsupportsStrictMode?: boolean;\n\t/** Whether to emit OpenAI custom tools with Lark/regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. Default: false; the generated model catalog enables it for capable models. */\n\tsupportsOpenAIGrammarTools?: boolean;\n\t/** Whether the model supports message-anchored `additional_tools` input items. Default: false. */\n\tsupportsAdditionalTools?: boolean;\n\t/** Whether the model supports client-executed tool search for transcript-anchored additions. Default: false. */\n\tsupportsToolSearch?: boolean;\n\t/** Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+ prompt caching). Older OpenAI models reject the parameter. Default: false. */\n\tsupportsExplicitPromptCacheMode?: boolean;\n\t/** Whether the provider accepts the `max_output_tokens` parameter. Some Codex-protocol gateways reject it. Default: true. */\n\tsupportsMaxOutputTokens?: boolean;\n}\n\n/** Compatibility settings for Anthropic Messages-compatible APIs. */\nexport interface AnthropicMessagesCompat {\n\t/**\n\t * Whether the provider accepts per-tool `eager_input_streaming`.\n\t * When false, the Anthropic provider omits `tools[].eager_input_streaming`\n\t * and sends the legacy `fine-grained-tool-streaming-2025-05-14` beta header\n\t * for tool-enabled requests.\n\t * Default: true.\n\t */\n\tsupportsEagerToolInputStreaming?: boolean;\n\t/** Whether the provider supports Anthropic long cache retention (`cache_control.ttl: \"1h\"`). Default: true. */\n\tsupportsLongCacheRetention?: boolean;\n\t/**\n\t * Whether to send a session-affinity header from `options.sessionId`\n\t * when caching is enabled. Required for providers like Fireworks that use\n\t * session affinity for prompt cache routing (requests to the same replica\n\t * maximize cache hits).\n\t * Default: true for OpenRouter endpoints, false otherwise.\n\t */\n\tsendSessionAffinityHeaders?: boolean;\n\t/** Session-affinity format. `\"openrouter\"` sends `x-session-id`; defaults to that format for OpenRouter endpoints and `x-session-affinity` elsewhere. */\n\tsessionAffinityFormat?: \"openrouter\";\n\t/**\n\t * Whether the provider supports Anthropic-style `cache_control` markers on\n\t * tool definitions. When false, `cache_control` is omitted from tool params.\n\t * Some Anthropic-compatible providers (e.g., Fireworks) do not support this\n\t * field on tools and may reject or ignore it.\n\t * Default: true.\n\t */\n\tsupportsCacheControlOnTools?: boolean;\n\t/**\n\t * Whether the model accepts the Anthropic `temperature` request field.\n\t * Claude Opus 4.7+ rejects non-default temperature values.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n\t/**\n\t * Whether to force adaptive thinking (`thinking.type: \"adaptive\"` plus\n\t * `output_config.effort`) regardless of the model id. Built-in models that\n\t * require adaptive thinking set this in generated metadata. Custom\n\t * Anthropic-compatible providers can set this to `true` for any model whose\n\t * upstream requires the adaptive format. Set to `false` to\n\t * opt out on overridden built-in models.\n\t * Default: false.\n\t */\n\tforceAdaptiveThinking?: boolean;\n\t/** Whether to replay empty thinking signatures as `signature: \"\"` instead of converting thinking to text. Default: false. */\n\tallowEmptySignature?: boolean;\n\t/** Whether the provider supports Anthropic strict tool schemas. Default: false; generated Anthropic models enable it explicitly. */\n\tsupportsStrictTools?: boolean;\n\t/** Whether the exact model transport supports effort-only system messages and thinking binding controls. Default: false. */\n\tsupportsMidConvoEffort?: boolean;\n\t/** Whether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt. Default: false. */\n\tsupportsMidConvoSystemMessages?: boolean;\n\t/** Whether the exact model accepts mid-conversation `tool_addition` blocks with inline tool definitions (`inline-tools-2026-09-15`) and `tool_removal` blocks. Requires `supportsMidConvoSystemMessages`. Default: false. */\n\tsupportsMidConvoToolChanges?: boolean;\n\t/**\n\t * Models Anthropic accepts in `fallbacks` for server-side refusal fallback,\n\t * with local pricing metadata for returned fallback responses. When absent or\n\t * empty, callers must omit `fallbacks`; Anthropic rejects the field for models\n\t * with no permitted fallback targets.\n\t */\n\tallowedFallbackModels?: AnthropicAllowedFallbackModel[];\n\t/**\n\t * Whether the model runs Anthropic's preserved-thinking *conversation* check, which\n\t * rejects a request whose `system` prompt, `tools`, or earlier messages changed since a\n\t * replayed thinking block was produced. When true the provider sends the\n\t * `thinking-binding-controls-2026-08-01` beta header and\n\t * `thinking.block_binding.prefix_mismatch_behavior: \"drop_block\"`, so a changed prefix\n\t * drops the affected thinking blocks instead of failing the request with a 400.\n\t * Enforced by default for Anthropic accounts created on or after 2026-08-31.\n\t * Default: false.\n\t */\n\tenforcesPreservedThinkingBinding?: boolean;\n\t/**\n\t * Whether the API adjudicates thinking-block *model* binding itself, always dropping a\n\t * block the target model cannot read. When true, an assistant turn produced by a\n\t * different model on the same provider and API replays its signed `thinking` and\n\t * `redacted_thinking` blocks unchanged rather than being rewritten into plain text, so a\n\t * mid-conversation model switch keeps reasoning the target model is allowed to read.\n\t * Default: false.\n\t */\n\tdelegatesThinkingModelBinding?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`tool_choice: {\"type\": \"any\"}` or\n\t * `{\"type\": \"tool\", ...}`). Claude Fable 5.1 and Claude Mythos 5.1 reject it on every\n\t * request with a 400; Anthropic's guidance for those models is to use\n\t * `tool_choice: {\"type\": \"auto\"}` with strict tool use or structured outputs instead.\n\t * When false, the provider rejects a forced choice with an error rather than sending a\n\t * request the model is guaranteed to refuse, or silently substituting a different one.\n\t * `auto` and `none` are never altered.\n\t * https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n}\n\n/** Compatibility settings for Amazon Bedrock models. */\nexport interface BedrockCompat {\n\t/** Whether the model supports Bedrock strict tool schemas. Default: false. */\n\tsupportsStrictMode?: boolean;\n\t/**\n\t * Whether the model accepts forced tool use (`toolChoice` `\"any\"` or `{ type: \"tool\" }`).\n\t * Claude Fable 5.1 rejects it on every request with a 400, whichever platform serves the\n\t * model. When false, the provider rejects a forced choice with an error rather than sending\n\t * a request that is guaranteed to fail. `auto` and `none` are never altered.\n\t * https://platform.claude.com/docs/en/build-with-claude/thinking\n\t * Default: true.\n\t */\n\tsupportsForcedToolChoice?: boolean;\n\t/**\n\t * Whether the model accepts `inferenceConfig.temperature`. Claude Fable 5.1 rejects\n\t * non-default `temperature`, `top_p`, and `top_k` on every request. When false, the\n\t * provider omits the field.\n\t * Default: true.\n\t */\n\tsupportsTemperature?: boolean;\n}\n\n/** Compatibility settings for the Mistral chat API. */\nexport interface MistralConversationsCompat {\n\t/** Whether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message. Default: false. */\n\tsupportsMidConvoSystemMessages?: boolean;\n}\n\n/**\n * OpenRouter provider routing preferences.\n * Controls which upstream providers OpenRouter routes requests to.\n * Sent as the `provider` field in the OpenRouter API request body.\n * @see https://openrouter.ai/docs/guides/routing/provider-selection\n */\nexport interface OpenRouterRouting {\n\t/** Whether to allow backup providers to serve requests. Default: true. */\n\tallow_fallbacks?: boolean;\n\t/** Whether to filter providers to only those that support all parameters in the request. Default: false. */\n\trequire_parameters?: boolean;\n\t/** Data collection setting. \"allow\" (default): allow providers that may store/train on data. \"deny\": only use providers that don't collect user data. */\n\tdata_collection?: \"deny\" | \"allow\";\n\t/** Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. */\n\tzdr?: boolean;\n\t/** Whether to restrict routing to only models that allow text distillation. */\n\tenforce_distillable_text?: boolean;\n\t/** An ordered list of provider names/slugs to try in sequence, falling back to the next if unavailable. */\n\torder?: string[];\n\t/** List of provider names/slugs to exclusively allow for this request. */\n\tonly?: string[];\n\t/** List of provider names/slugs to skip for this request. */\n\tignore?: string[];\n\t/** A list of quantization levels to filter providers by (e.g., [\"fp16\", \"bf16\", \"fp8\", \"fp6\", \"int8\", \"int4\", \"fp4\", \"fp32\"]). */\n\tquantizations?: string[];\n\t/** Sorting strategy. Can be a string (e.g., \"price\", \"throughput\", \"latency\") or an object with `by` and `partition`. */\n\tsort?:\n\t\t| string\n\t\t| {\n\t\t\t\t/** The sorting metric: \"price\", \"throughput\", \"latency\". */\n\t\t\t\tby?: string;\n\t\t\t\t/** Partitioning strategy: \"model\" (default) or \"none\". */\n\t\t\t\tpartition?: string | null;\n\t\t };\n\t/** Maximum price per million tokens (USD). */\n\tmax_price?: {\n\t\t/** Price per million prompt tokens. */\n\t\tprompt?: number | string;\n\t\t/** Price per million completion tokens. */\n\t\tcompletion?: number | string;\n\t\t/** Price per image. */\n\t\timage?: number | string;\n\t\t/** Price per audio unit. */\n\t\taudio?: number | string;\n\t\t/** Price per request. */\n\t\trequest?: number | string;\n\t};\n\t/** Preferred minimum throughput (tokens/second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_min_throughput?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Minimum tokens/second at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Minimum tokens/second at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Minimum tokens/second at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Minimum tokens/second at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n\t/** Preferred maximum latency (seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. */\n\tpreferred_max_latency?:\n\t\t| number\n\t\t| {\n\t\t\t\t/** Maximum latency in seconds at the 50th percentile. */\n\t\t\t\tp50?: number;\n\t\t\t\t/** Maximum latency in seconds at the 75th percentile. */\n\t\t\t\tp75?: number;\n\t\t\t\t/** Maximum latency in seconds at the 90th percentile. */\n\t\t\t\tp90?: number;\n\t\t\t\t/** Maximum latency in seconds at the 99th percentile. */\n\t\t\t\tp99?: number;\n\t\t };\n}\n\n/**\n * Vercel AI Gateway routing preferences.\n * Controls which upstream providers the gateway routes requests to.\n * @see https://vercel.com/docs/ai-gateway/models-and-providers/provider-options\n */\nexport interface VercelGatewayRouting {\n\t/** List of provider slugs to exclusively use for this request (e.g., [\"bedrock\", \"anthropic\"]). */\n\tonly?: string[];\n\t/** List of provider slugs to try in order (e.g., [\"anthropic\", \"openai\"]). */\n\torder?: string[];\n}\n\nexport interface ModelCostRates {\n\tinput: number; // $/million tokens\n\toutput: number; // $/million tokens\n\tcacheRead: number; // $/million tokens\n\tcacheWrite: number; // $/million tokens\n}\n\nexport interface ModelCostTier extends ModelCostRates {\n\t/** Use this tier for requests whose total input usage exceeds this token count. */\n\tinputTokensAbove: number;\n}\n\nexport interface ModelCost extends ModelCostRates {\n\t/** Request-wide pricing tiers. The highest matching input threshold applies to the full request. */\n\ttiers?: ModelCostTier[];\n}\n\nexport interface ModelImageResizeOptions {\n\tmaxWidth?: number;\n\tmaxHeight?: number;\n\t/** Maximum base64-encoded payload size in bytes. */\n\tmaxBytes?: number;\n\tjpegQuality?: number;\n}\n\nexport interface ModelImageInputLimits {\n\t/** Cache-safe resize profile applied before a new image enters conversation history. */\n\tresize?: ModelImageResizeOptions;\n\t/** Maximum images accepted in one provider message. */\n\tmaxPerMessage?: number;\n\t/** Maximum images accepted across one provider request. */\n\tmaxPerRequest?: number;\n}\n\nexport interface ModelInputLimits {\n\t/** Maximum serialized provider request size in bytes. */\n\tmaxRequestBytes?: number;\n\timages?: ModelImageInputLimits;\n}\n\n/** Service tiers a model can advertise beyond standard processing. */\nexport type ModelServiceTierId = \"priority\" | \"ultrafast\";\n\n/**\n * A service tier a model advertises, following Codex's `ModelInfo.service_tiers`, with the provider's\n * published per-million-token rates for that tier.\n *\n * Adapters send a tier only when the model advertises it. `flex` is an API request option and needs\n * no advertisement.\n */\nexport interface ModelServiceTier {\n\tid: ModelServiceTierId;\n\tcost: ModelCost;\n}\n\n/**\n * Explicit routing metadata that marks a model as the fast-inference variant of another model.\n *\n * Presence of this field — never a `-fast` name suffix — is what gives a model fast semantics.\n * A provider, `models.json` custom model, or extension may own an exact `<base>-fast` ID without\n * this metadata, in which case it is an ordinary model and routes exactly as it is declared.\n */\nexport interface ModelFastRoute {\n\t/** Canonical ID of the normal-speed model this variant pairs with, in the same provider. */\n\tbaseModelId: string;\n\t/** Model ID to send upstream. OpenAI-style routing keeps the base ID; a provider with real fast siblings sends its own ID. */\n\tupstreamModelId: string;\n\t/** Service tier to send with the request. Set only for providers that route fast traffic through an OpenAI-style tier. */\n\tserviceTier?: ModelServiceTierId;\n\t/** Anthropic inference speed to send with the request. Set only for Claude models that support fast mode. */\n\tspeed?: \"fast\";\n}\n\n/** Fields shared by every catalog entry, regardless of what you can do with it. */\nexport interface BaseModel<TApi extends string> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: ProviderId;\n\tbaseUrl: string;\n\tinput: (\"text\" | \"image\" | \"pdf\")[];\n\t/** Provider input limits and cache-safe preprocessing metadata. */\n\tinputLimits?: ModelInputLimits;\n\tcost: ModelCost;\n\theaders?: Record<string, string>;\n}\n\n/** Chat model: usable with `stream()` and friends. */\nexport interface Model<TApi extends Api> extends BaseModel<TApi> {\n\t/**\n\t * Optional: chat is the default model type, so models without `type` are chat\n\t * models. Narrow mixed model lists with `isModelType()` instead of comparing\n\t * `type` directly.\n\t */\n\ttype?: \"chat\";\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * Missing keys use provider defaults. null marks a level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\t/** Prompt cache lifetimes per retention tier. Unset when the provider's cache behavior is unknown. */\n\tpromptCache?: ModelPromptCache;\n\tcontextWindow: number;\n\tmaxTokens: number;\n\t/** Default sampling parameters for this model. See {@link StreamOptions.samplingParams}; per-request keys override these. */\n\tsamplingParams?: SamplingParams;\n\t/** Sampling parameter overrides selected by the effective pi thinking level. */\n\tsamplingParamsByThinkingLevel?: SamplingParamsByThinkingLevel;\n\t/**\n\t * Marks this model as the fast-inference variant of {@link ModelFastRoute.baseModelId} and carries the\n\t * upstream routing it needs. Absent on every normal model.\n\t */\n\tfastRoute?: ModelFastRoute;\n\t/**\n\t * Service tiers this model advertises. When set, the Codex adapter sends only advertised tiers.\n\t * When unset, the model carries no tier metadata and only Ultrafast is withheld.\n\t */\n\tserviceTiers?: ModelServiceTier[];\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\" | \"azure-openai-responses\" | \"openai-codex-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: TApi extends \"bedrock-converse-stream\"\n\t\t\t\t\t? BedrockCompat\n\t\t\t\t\t: TApi extends \"mistral-conversations\"\n\t\t\t\t\t\t? MistralConversationsCompat\n\t\t\t\t\t\t: never;\n}\n\n/** Image-generation model: usable with `generateImages()` only. */\nexport interface ImageModel<TApi extends ImageApi> extends BaseModel<TApi> {\n\ttype: \"image\";\n\t/** Output modalities. Always includes `\"image\"`; `\"text\"` means the model can also return text blocks. */\n\toutput: (\"text\" | \"image\")[];\n}\n\n/** Structured classifier model: usable with `classify()` only. */\nexport interface ClassifierModel<TApi extends ClassifierApi> extends BaseModel<TApi> {\n\ttype: \"classifier\";\n\tcontextWindow: number;\n}\n\n/** Model shape for each model type. */\nexport interface ModelTypeMap {\n\tchat: Model<Api>;\n\timage: ImageModel<ImageApi>;\n\tclassifier: ClassifierModel<ClassifierApi>;\n}\n\n/** What a catalog entry is for. Decides which `Models` operation accepts it. */\nexport type ModelType = keyof ModelTypeMap;\n\n/** Anything a provider can list. Narrow with `isModelType()`. */\nexport type AnyModel = ModelTypeMap[ModelType];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/pi-ai",
3
- "version": "0.9.26-alpha.5",
3
+ "version": "0.9.26",
4
4
  "description": "Bastani-branded unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -77,7 +77,7 @@
77
77
  "dependencies": {
78
78
  "@anthropic-ai/sdk": "0.129.0",
79
79
  "@aws-sdk/client-bedrock-runtime": "3.1127.0",
80
- "@earendil-works/pi-telemetry": "1.0.1",
80
+ "@earendil-works/pi-telemetry": "1.0.2",
81
81
  "@google/genai": "2.21.0",
82
82
  "@smithy/node-http-handler": "4.12.1",
83
83
  "http-proxy-agent": "9.1.0",