@assemble-dev/providers 0.3.0 → 0.4.0

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/index.d.cts CHANGED
@@ -357,12 +357,17 @@ declare function buildProviderCanceledError(providerLabel: string): AppError;
357
357
  declare function executeAbortableProviderFetch(providerLabel: string, performFetch: () => Promise<Response>): Promise<Response>;
358
358
 
359
359
  declare const openAiStructuredOutputSchemaName = "structured_output";
360
+ declare function isZodV4Schema<T>(schema: z.ZodType<T>): boolean;
360
361
  declare function convertZodSchemaToJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
361
362
  declare function buildAnthropicStructuredOutputJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
362
363
  declare function sanitizeJsonSchemaForAnthropicStructuredOutput(jsonSchema: JsonObject): JsonObject;
363
364
  declare function buildOpenAiStructuredOutputJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
364
365
  declare function sanitizeJsonSchemaForOpenAiStructuredOutput(jsonSchema: JsonObject): JsonObject;
365
366
 
367
+ declare const structuredOutputJsonOnlySystemInstruction = "Respond with a single JSON object that satisfies the caller's requested structure. Output only valid JSON with no surrounding text.";
368
+ declare const structuredOutputJsonOnlySystemMessage: ChatMessage;
369
+ declare function prependStructuredOutputJsonOnlySystemMessage(messages: ChatMessage[]): ChatMessage[];
370
+
366
371
  declare function buildGeminiResponseSchema<T>(schema: z.ZodType<T>): JsonObject;
367
372
  declare function sanitizeJsonSchemaForGeminiResponseSchema(jsonSchema: JsonObject): JsonObject;
368
373
 
@@ -539,6 +544,7 @@ type OpenAiRequestBody = {
539
544
  messages: OpenAiRequestMessage[];
540
545
  temperature?: number;
541
546
  max_tokens?: number;
547
+ max_completion_tokens?: number;
542
548
  response_format?: OpenAiResponseFormat;
543
549
  tools?: OpenAiToolDefinition[];
544
550
  tool_choice?: OpenAiToolChoice;
@@ -547,6 +553,7 @@ type OpenAiCallInput = {
547
553
  messages: ChatMessage[];
548
554
  temperature?: number;
549
555
  maxOutputTokens?: number;
556
+ reasoningModel?: boolean;
550
557
  structuredOutputJsonSchema?: JsonObject;
551
558
  requireJsonObjectResponse?: boolean;
552
559
  tools?: ModelToolDefinition[];
@@ -554,6 +561,13 @@ type OpenAiCallInput = {
554
561
  abortSignal?: AbortSignal;
555
562
  extraBody?: Record<string, JsonValue>;
556
563
  };
564
+ type OpenAiStructuredOutputMode = {
565
+ messages: ChatMessage[];
566
+ structuredOutputJsonSchema?: JsonObject;
567
+ requireJsonObjectResponse?: boolean;
568
+ };
569
+ declare function isOpenAiReasoningModel(model: string): boolean;
570
+ declare function resolveOpenAiStructuredOutputMode<T>(messages: ChatMessage[], schema: z.ZodType<T>): OpenAiStructuredOutputMode;
557
571
  declare function buildOpenAiRequestBody(model: string, input: OpenAiCallInput): OpenAiRequestBody;
558
572
  declare function mapModelToolDefinitionToOpenAiTool(tool: ModelToolDefinition): OpenAiToolDefinition;
559
573
  declare function mapModelToolChoiceToOpenAiToolChoice(toolChoice: ModelToolChoice): OpenAiToolChoice;
@@ -695,6 +709,7 @@ type AzureOpenAiAdapterOptions = {
695
709
  fetchImplementation?: typeof fetch;
696
710
  temperature?: number;
697
711
  maxOutputTokens?: number;
712
+ reasoningModel?: boolean;
698
713
  retry?: ProviderRetryOptions;
699
714
  extraBody?: Record<string, JsonValue>;
700
715
  };
@@ -791,4 +806,39 @@ declare function buildBedrockInvokeModelUrl(region: string, modelId: string): st
791
806
  declare function resolveBedrockCredentials(options: BedrockAdapterOptions): BedrockCredentials;
792
807
  declare function buildBedrockInvokeModelRequestBody(input: AnthropicRequestInput): BedrockInvokeModelRequestBody;
793
808
 
794
- export { type AnthropicAdapterOptions, type AnthropicBatchApiRequest, type AnthropicBatchApiRequestMessage, type AnthropicBatchApiRequestParams, type AnthropicBatchCanceledOutcome, type AnthropicBatchClient, type AnthropicBatchClientOptions, type AnthropicBatchErroredOutcome, type AnthropicBatchExpiredOutcome, type AnthropicBatchMessageRequest, type AnthropicBatchPromptCachingMode, type AnthropicBatchResult, type AnthropicBatchResultOutcome, type AnthropicBatchSubmittedRequestSummary, type AnthropicBatchSucceededOutcome, type AnthropicBatchSystemContentBlock, type AnthropicBatchTraceEventHandler, type AnthropicBatchWaitOptions, type AnthropicCacheControl, type AnthropicCacheTtl, type AnthropicMessageBatch, type AnthropicMessageBatchProcessingStatus, type AnthropicMessageBatchRequestCounts, type AnthropicMessagesResponse, AnthropicMessagesResponseSchema, type AnthropicOutputConfig, type AnthropicPromptCachingMode, type AnthropicPromptCachingOptions, type AnthropicPromptCachingSettings, type AnthropicRequestBody, type AnthropicRequestContentBlock, type AnthropicRequestInput, type AnthropicRequestMessage, type AnthropicRequestSettings, type AnthropicStreamEvent, AnthropicStreamEventSchema, type AnthropicStreamRequestInput, type AnthropicStreamStartUsage, type AnthropicSystemContentBlock, type AnthropicThinkingOptions, type AnthropicToolChoice, type AnthropicToolDefinition, type AnthropicUsage, type AwsCredentials, type AwsSigV4SigningInput, type AzureOpenAiAdapterOptions, type AzureOpenAiChatCompletionResponse, AzureOpenAiChatCompletionResponseSchema, type AzureOpenAiChatRequestBody, type AzureOpenAiStreamRequestBody, type AzureOpenAiStreamRequestInput, type AzureOpenAiUsage, type BedrockAdapterOptions, type BedrockCredentials, type BedrockInvokeModelRequestBody, type ChatCompletionRequest, type ChatCompletionResult, type ChatMessage, type ChatMessageCacheControl, ChatMessageCacheControlSchema, type ChatMessageRole, ChatMessageRoleSchema, ChatMessageSchema, type ChatStopReason, ChatStopReasonSchema, type ChatStreamEvent, type GeminiAdapterOptions, type MessageContentBlock, MessageContentBlockSchema, type MockModelOptions, type ModelAdapter, type ModelPricingUsdPerMillionTokens, type ModelToolCall, ModelToolCallSchema, type ModelToolChoice, type ModelToolDefinition, type OpenAiAdapterOptions, type OpenAiCallInput, type OpenAiContentPart, type OpenAiRequestBody, type OpenAiRequestMessage, type OpenAiRequestToolCall, type OpenAiResponseFormat, type OpenAiToolChoice, type OpenAiToolDefinition, type ProviderExtraBody, type ProviderRetryOptions, type ResolveProviderApiKeyInput, type StructuredOutputRequest, type StructuredOutputResult, anthropic, anthropicBatchJsonOnlySystemInstruction, anthropicBatchTraceWorkflowName, applyCacheControlToLastContentBlock, awsSigV4Algorithm, azureOpenai, bedrock, bedrockAnthropicVersion, buildAnthropicCacheControl, buildAnthropicRequestBody, buildAnthropicStructuredOutputJsonSchema, buildAzureOpenAiChatCompletionsUrl, buildAzureOpenAiChatRequestBody, buildBedrockInvokeModelRequestBody, buildBedrockInvokeModelUrl, buildGeminiResponseSchema, buildOpenAiRequestBody, buildOpenAiStructuredOutputJsonSchema, buildProviderCanceledError, calculateProviderRetryDelayMs, convertZodSchemaToJsonSchema, createAnthropicBatchClient, defaultAnthropicBaseUrl, defaultAnthropicBatchPollIntervalMs, defaultAnthropicBatchTimeoutMs, defaultAnthropicMaxOutputTokens, defaultAzureOpenAiApiVersion, defaultBedrockMaxOutputTokens, defaultGeminiBaseUrl, defaultOpenAiBaseUrl, defaultProviderRetryInitialDelayMs, defaultProviderRetryMaxAttempts, defaultProviderRetryMaxDelayMs, estimateModelCallCostUsd, executeAbortableProviderFetch, executeProviderCallWithModelFallback, executeProviderCallWithRetry, extractAnthropicTextContent, extractAnthropicThinkingText, extractAnthropicToolCalls, extractMessageText, gemini, isAbortError, isRetryableProviderAppError, joinSystemMessageText, mapAnthropicResponseToChatCompletionResult, mapAnthropicUsageToTokenUsage, mapAzureOpenAiResponseToChatCompletionResult, mapAzureOpenAiUsageToTokenUsage, mapChatMessageToAnthropicRequestMessage, mapChatMessageToOpenAiRequestMessage, mapModelToolChoiceToAnthropicToolChoice, mapModelToolChoiceToOpenAiToolChoice, mapModelToolDefinitionToOpenAiTool, mapModelToolDefinitionsToAnthropicTools, mergeProviderRequestExtraBody, mockModel, normalizeAnthropicStopReason, normalizeAzureOpenAiFinishReason, openAiStructuredOutputSchemaName, openai, parseAnthropicBatchStructuredContent, parseAnthropicStreamEvents, parseAnthropicToolInputJson, parseAzureOpenAiStreamEvents, parseAzureOpenAiToolArgumentsJson, resolveAnthropicPromptCachingSettings, resolveBedrockCredentials, resolveProviderApiKey, sanitizeJsonSchemaForAnthropicStructuredOutput, sanitizeJsonSchemaForGeminiResponseSchema, sanitizeJsonSchemaForOpenAiStructuredOutput, signAwsRequestWithSigV4, streamAnthropicChatCompletion, streamAzureOpenAiChatCompletion };
809
+ declare const defaultOpenRouterBaseUrl = "https://openrouter.ai/api/v1";
810
+ type OpenRouterAdapterOptions = {
811
+ model: string;
812
+ baseURL?: string;
813
+ apiKey?: string;
814
+ apiKeyName?: string;
815
+ fetchImplementation?: typeof fetch;
816
+ temperature?: number;
817
+ maxOutputTokens?: number;
818
+ reasoningModel?: boolean;
819
+ retry?: ProviderRetryOptions;
820
+ fallbackModel?: string;
821
+ extraBody?: Record<string, JsonValue>;
822
+ appUrl?: string;
823
+ appName?: string;
824
+ };
825
+ declare function openrouter(options: OpenRouterAdapterOptions): ModelAdapter;
826
+
827
+ declare const defaultCloudflareApiBaseUrl = "https://api.cloudflare.com/client/v4";
828
+ type CloudflareWorkersAiAdapterOptions = {
829
+ model: string;
830
+ accountId?: string;
831
+ baseURL?: string;
832
+ apiKey?: string;
833
+ apiKeyName?: string;
834
+ fetchImplementation?: typeof fetch;
835
+ temperature?: number;
836
+ maxOutputTokens?: number;
837
+ retry?: ProviderRetryOptions;
838
+ fallbackModel?: string;
839
+ extraBody?: Record<string, JsonValue>;
840
+ };
841
+ declare function cloudflareWorkersAi(options: CloudflareWorkersAiAdapterOptions): ModelAdapter;
842
+ declare function buildCloudflareWorkersAiChatCompletionsUrl(options: CloudflareWorkersAiAdapterOptions): string;
843
+
844
+ export { type AnthropicAdapterOptions, type AnthropicBatchApiRequest, type AnthropicBatchApiRequestMessage, type AnthropicBatchApiRequestParams, type AnthropicBatchCanceledOutcome, type AnthropicBatchClient, type AnthropicBatchClientOptions, type AnthropicBatchErroredOutcome, type AnthropicBatchExpiredOutcome, type AnthropicBatchMessageRequest, type AnthropicBatchPromptCachingMode, type AnthropicBatchResult, type AnthropicBatchResultOutcome, type AnthropicBatchSubmittedRequestSummary, type AnthropicBatchSucceededOutcome, type AnthropicBatchSystemContentBlock, type AnthropicBatchTraceEventHandler, type AnthropicBatchWaitOptions, type AnthropicCacheControl, type AnthropicCacheTtl, type AnthropicMessageBatch, type AnthropicMessageBatchProcessingStatus, type AnthropicMessageBatchRequestCounts, type AnthropicMessagesResponse, AnthropicMessagesResponseSchema, type AnthropicOutputConfig, type AnthropicPromptCachingMode, type AnthropicPromptCachingOptions, type AnthropicPromptCachingSettings, type AnthropicRequestBody, type AnthropicRequestContentBlock, type AnthropicRequestInput, type AnthropicRequestMessage, type AnthropicRequestSettings, type AnthropicStreamEvent, AnthropicStreamEventSchema, type AnthropicStreamRequestInput, type AnthropicStreamStartUsage, type AnthropicSystemContentBlock, type AnthropicThinkingOptions, type AnthropicToolChoice, type AnthropicToolDefinition, type AnthropicUsage, type AwsCredentials, type AwsSigV4SigningInput, type AzureOpenAiAdapterOptions, type AzureOpenAiChatCompletionResponse, AzureOpenAiChatCompletionResponseSchema, type AzureOpenAiChatRequestBody, type AzureOpenAiStreamRequestBody, type AzureOpenAiStreamRequestInput, type AzureOpenAiUsage, type BedrockAdapterOptions, type BedrockCredentials, type BedrockInvokeModelRequestBody, type ChatCompletionRequest, type ChatCompletionResult, type ChatMessage, type ChatMessageCacheControl, ChatMessageCacheControlSchema, type ChatMessageRole, ChatMessageRoleSchema, ChatMessageSchema, type ChatStopReason, ChatStopReasonSchema, type ChatStreamEvent, type CloudflareWorkersAiAdapterOptions, type GeminiAdapterOptions, type MessageContentBlock, MessageContentBlockSchema, type MockModelOptions, type ModelAdapter, type ModelPricingUsdPerMillionTokens, type ModelToolCall, ModelToolCallSchema, type ModelToolChoice, type ModelToolDefinition, type OpenAiAdapterOptions, type OpenAiCallInput, type OpenAiContentPart, type OpenAiRequestBody, type OpenAiRequestMessage, type OpenAiRequestToolCall, type OpenAiResponseFormat, type OpenAiStructuredOutputMode, type OpenAiToolChoice, type OpenAiToolDefinition, type OpenRouterAdapterOptions, type ProviderExtraBody, type ProviderRetryOptions, type ResolveProviderApiKeyInput, type StructuredOutputRequest, type StructuredOutputResult, anthropic, anthropicBatchJsonOnlySystemInstruction, anthropicBatchTraceWorkflowName, applyCacheControlToLastContentBlock, awsSigV4Algorithm, azureOpenai, bedrock, bedrockAnthropicVersion, buildAnthropicCacheControl, buildAnthropicRequestBody, buildAnthropicStructuredOutputJsonSchema, buildAzureOpenAiChatCompletionsUrl, buildAzureOpenAiChatRequestBody, buildBedrockInvokeModelRequestBody, buildBedrockInvokeModelUrl, buildCloudflareWorkersAiChatCompletionsUrl, buildGeminiResponseSchema, buildOpenAiRequestBody, buildOpenAiStructuredOutputJsonSchema, buildProviderCanceledError, calculateProviderRetryDelayMs, cloudflareWorkersAi, convertZodSchemaToJsonSchema, createAnthropicBatchClient, defaultAnthropicBaseUrl, defaultAnthropicBatchPollIntervalMs, defaultAnthropicBatchTimeoutMs, defaultAnthropicMaxOutputTokens, defaultAzureOpenAiApiVersion, defaultBedrockMaxOutputTokens, defaultCloudflareApiBaseUrl, defaultGeminiBaseUrl, defaultOpenAiBaseUrl, defaultOpenRouterBaseUrl, defaultProviderRetryInitialDelayMs, defaultProviderRetryMaxAttempts, defaultProviderRetryMaxDelayMs, estimateModelCallCostUsd, executeAbortableProviderFetch, executeProviderCallWithModelFallback, executeProviderCallWithRetry, extractAnthropicTextContent, extractAnthropicThinkingText, extractAnthropicToolCalls, extractMessageText, gemini, isAbortError, isOpenAiReasoningModel, isRetryableProviderAppError, isZodV4Schema, joinSystemMessageText, mapAnthropicResponseToChatCompletionResult, mapAnthropicUsageToTokenUsage, mapAzureOpenAiResponseToChatCompletionResult, mapAzureOpenAiUsageToTokenUsage, mapChatMessageToAnthropicRequestMessage, mapChatMessageToOpenAiRequestMessage, mapModelToolChoiceToAnthropicToolChoice, mapModelToolChoiceToOpenAiToolChoice, mapModelToolDefinitionToOpenAiTool, mapModelToolDefinitionsToAnthropicTools, mergeProviderRequestExtraBody, mockModel, normalizeAnthropicStopReason, normalizeAzureOpenAiFinishReason, openAiStructuredOutputSchemaName, openai, openrouter, parseAnthropicBatchStructuredContent, parseAnthropicStreamEvents, parseAnthropicToolInputJson, parseAzureOpenAiStreamEvents, parseAzureOpenAiToolArgumentsJson, prependStructuredOutputJsonOnlySystemMessage, resolveAnthropicPromptCachingSettings, resolveBedrockCredentials, resolveOpenAiStructuredOutputMode, resolveProviderApiKey, sanitizeJsonSchemaForAnthropicStructuredOutput, sanitizeJsonSchemaForGeminiResponseSchema, sanitizeJsonSchemaForOpenAiStructuredOutput, signAwsRequestWithSigV4, streamAnthropicChatCompletion, streamAzureOpenAiChatCompletion, structuredOutputJsonOnlySystemInstruction, structuredOutputJsonOnlySystemMessage };
package/dist/index.d.ts CHANGED
@@ -357,12 +357,17 @@ declare function buildProviderCanceledError(providerLabel: string): AppError;
357
357
  declare function executeAbortableProviderFetch(providerLabel: string, performFetch: () => Promise<Response>): Promise<Response>;
358
358
 
359
359
  declare const openAiStructuredOutputSchemaName = "structured_output";
360
+ declare function isZodV4Schema<T>(schema: z.ZodType<T>): boolean;
360
361
  declare function convertZodSchemaToJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
361
362
  declare function buildAnthropicStructuredOutputJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
362
363
  declare function sanitizeJsonSchemaForAnthropicStructuredOutput(jsonSchema: JsonObject): JsonObject;
363
364
  declare function buildOpenAiStructuredOutputJsonSchema<T>(schema: z.ZodType<T>): JsonObject;
364
365
  declare function sanitizeJsonSchemaForOpenAiStructuredOutput(jsonSchema: JsonObject): JsonObject;
365
366
 
367
+ declare const structuredOutputJsonOnlySystemInstruction = "Respond with a single JSON object that satisfies the caller's requested structure. Output only valid JSON with no surrounding text.";
368
+ declare const structuredOutputJsonOnlySystemMessage: ChatMessage;
369
+ declare function prependStructuredOutputJsonOnlySystemMessage(messages: ChatMessage[]): ChatMessage[];
370
+
366
371
  declare function buildGeminiResponseSchema<T>(schema: z.ZodType<T>): JsonObject;
367
372
  declare function sanitizeJsonSchemaForGeminiResponseSchema(jsonSchema: JsonObject): JsonObject;
368
373
 
@@ -539,6 +544,7 @@ type OpenAiRequestBody = {
539
544
  messages: OpenAiRequestMessage[];
540
545
  temperature?: number;
541
546
  max_tokens?: number;
547
+ max_completion_tokens?: number;
542
548
  response_format?: OpenAiResponseFormat;
543
549
  tools?: OpenAiToolDefinition[];
544
550
  tool_choice?: OpenAiToolChoice;
@@ -547,6 +553,7 @@ type OpenAiCallInput = {
547
553
  messages: ChatMessage[];
548
554
  temperature?: number;
549
555
  maxOutputTokens?: number;
556
+ reasoningModel?: boolean;
550
557
  structuredOutputJsonSchema?: JsonObject;
551
558
  requireJsonObjectResponse?: boolean;
552
559
  tools?: ModelToolDefinition[];
@@ -554,6 +561,13 @@ type OpenAiCallInput = {
554
561
  abortSignal?: AbortSignal;
555
562
  extraBody?: Record<string, JsonValue>;
556
563
  };
564
+ type OpenAiStructuredOutputMode = {
565
+ messages: ChatMessage[];
566
+ structuredOutputJsonSchema?: JsonObject;
567
+ requireJsonObjectResponse?: boolean;
568
+ };
569
+ declare function isOpenAiReasoningModel(model: string): boolean;
570
+ declare function resolveOpenAiStructuredOutputMode<T>(messages: ChatMessage[], schema: z.ZodType<T>): OpenAiStructuredOutputMode;
557
571
  declare function buildOpenAiRequestBody(model: string, input: OpenAiCallInput): OpenAiRequestBody;
558
572
  declare function mapModelToolDefinitionToOpenAiTool(tool: ModelToolDefinition): OpenAiToolDefinition;
559
573
  declare function mapModelToolChoiceToOpenAiToolChoice(toolChoice: ModelToolChoice): OpenAiToolChoice;
@@ -695,6 +709,7 @@ type AzureOpenAiAdapterOptions = {
695
709
  fetchImplementation?: typeof fetch;
696
710
  temperature?: number;
697
711
  maxOutputTokens?: number;
712
+ reasoningModel?: boolean;
698
713
  retry?: ProviderRetryOptions;
699
714
  extraBody?: Record<string, JsonValue>;
700
715
  };
@@ -791,4 +806,39 @@ declare function buildBedrockInvokeModelUrl(region: string, modelId: string): st
791
806
  declare function resolveBedrockCredentials(options: BedrockAdapterOptions): BedrockCredentials;
792
807
  declare function buildBedrockInvokeModelRequestBody(input: AnthropicRequestInput): BedrockInvokeModelRequestBody;
793
808
 
794
- export { type AnthropicAdapterOptions, type AnthropicBatchApiRequest, type AnthropicBatchApiRequestMessage, type AnthropicBatchApiRequestParams, type AnthropicBatchCanceledOutcome, type AnthropicBatchClient, type AnthropicBatchClientOptions, type AnthropicBatchErroredOutcome, type AnthropicBatchExpiredOutcome, type AnthropicBatchMessageRequest, type AnthropicBatchPromptCachingMode, type AnthropicBatchResult, type AnthropicBatchResultOutcome, type AnthropicBatchSubmittedRequestSummary, type AnthropicBatchSucceededOutcome, type AnthropicBatchSystemContentBlock, type AnthropicBatchTraceEventHandler, type AnthropicBatchWaitOptions, type AnthropicCacheControl, type AnthropicCacheTtl, type AnthropicMessageBatch, type AnthropicMessageBatchProcessingStatus, type AnthropicMessageBatchRequestCounts, type AnthropicMessagesResponse, AnthropicMessagesResponseSchema, type AnthropicOutputConfig, type AnthropicPromptCachingMode, type AnthropicPromptCachingOptions, type AnthropicPromptCachingSettings, type AnthropicRequestBody, type AnthropicRequestContentBlock, type AnthropicRequestInput, type AnthropicRequestMessage, type AnthropicRequestSettings, type AnthropicStreamEvent, AnthropicStreamEventSchema, type AnthropicStreamRequestInput, type AnthropicStreamStartUsage, type AnthropicSystemContentBlock, type AnthropicThinkingOptions, type AnthropicToolChoice, type AnthropicToolDefinition, type AnthropicUsage, type AwsCredentials, type AwsSigV4SigningInput, type AzureOpenAiAdapterOptions, type AzureOpenAiChatCompletionResponse, AzureOpenAiChatCompletionResponseSchema, type AzureOpenAiChatRequestBody, type AzureOpenAiStreamRequestBody, type AzureOpenAiStreamRequestInput, type AzureOpenAiUsage, type BedrockAdapterOptions, type BedrockCredentials, type BedrockInvokeModelRequestBody, type ChatCompletionRequest, type ChatCompletionResult, type ChatMessage, type ChatMessageCacheControl, ChatMessageCacheControlSchema, type ChatMessageRole, ChatMessageRoleSchema, ChatMessageSchema, type ChatStopReason, ChatStopReasonSchema, type ChatStreamEvent, type GeminiAdapterOptions, type MessageContentBlock, MessageContentBlockSchema, type MockModelOptions, type ModelAdapter, type ModelPricingUsdPerMillionTokens, type ModelToolCall, ModelToolCallSchema, type ModelToolChoice, type ModelToolDefinition, type OpenAiAdapterOptions, type OpenAiCallInput, type OpenAiContentPart, type OpenAiRequestBody, type OpenAiRequestMessage, type OpenAiRequestToolCall, type OpenAiResponseFormat, type OpenAiToolChoice, type OpenAiToolDefinition, type ProviderExtraBody, type ProviderRetryOptions, type ResolveProviderApiKeyInput, type StructuredOutputRequest, type StructuredOutputResult, anthropic, anthropicBatchJsonOnlySystemInstruction, anthropicBatchTraceWorkflowName, applyCacheControlToLastContentBlock, awsSigV4Algorithm, azureOpenai, bedrock, bedrockAnthropicVersion, buildAnthropicCacheControl, buildAnthropicRequestBody, buildAnthropicStructuredOutputJsonSchema, buildAzureOpenAiChatCompletionsUrl, buildAzureOpenAiChatRequestBody, buildBedrockInvokeModelRequestBody, buildBedrockInvokeModelUrl, buildGeminiResponseSchema, buildOpenAiRequestBody, buildOpenAiStructuredOutputJsonSchema, buildProviderCanceledError, calculateProviderRetryDelayMs, convertZodSchemaToJsonSchema, createAnthropicBatchClient, defaultAnthropicBaseUrl, defaultAnthropicBatchPollIntervalMs, defaultAnthropicBatchTimeoutMs, defaultAnthropicMaxOutputTokens, defaultAzureOpenAiApiVersion, defaultBedrockMaxOutputTokens, defaultGeminiBaseUrl, defaultOpenAiBaseUrl, defaultProviderRetryInitialDelayMs, defaultProviderRetryMaxAttempts, defaultProviderRetryMaxDelayMs, estimateModelCallCostUsd, executeAbortableProviderFetch, executeProviderCallWithModelFallback, executeProviderCallWithRetry, extractAnthropicTextContent, extractAnthropicThinkingText, extractAnthropicToolCalls, extractMessageText, gemini, isAbortError, isRetryableProviderAppError, joinSystemMessageText, mapAnthropicResponseToChatCompletionResult, mapAnthropicUsageToTokenUsage, mapAzureOpenAiResponseToChatCompletionResult, mapAzureOpenAiUsageToTokenUsage, mapChatMessageToAnthropicRequestMessage, mapChatMessageToOpenAiRequestMessage, mapModelToolChoiceToAnthropicToolChoice, mapModelToolChoiceToOpenAiToolChoice, mapModelToolDefinitionToOpenAiTool, mapModelToolDefinitionsToAnthropicTools, mergeProviderRequestExtraBody, mockModel, normalizeAnthropicStopReason, normalizeAzureOpenAiFinishReason, openAiStructuredOutputSchemaName, openai, parseAnthropicBatchStructuredContent, parseAnthropicStreamEvents, parseAnthropicToolInputJson, parseAzureOpenAiStreamEvents, parseAzureOpenAiToolArgumentsJson, resolveAnthropicPromptCachingSettings, resolveBedrockCredentials, resolveProviderApiKey, sanitizeJsonSchemaForAnthropicStructuredOutput, sanitizeJsonSchemaForGeminiResponseSchema, sanitizeJsonSchemaForOpenAiStructuredOutput, signAwsRequestWithSigV4, streamAnthropicChatCompletion, streamAzureOpenAiChatCompletion };
809
+ declare const defaultOpenRouterBaseUrl = "https://openrouter.ai/api/v1";
810
+ type OpenRouterAdapterOptions = {
811
+ model: string;
812
+ baseURL?: string;
813
+ apiKey?: string;
814
+ apiKeyName?: string;
815
+ fetchImplementation?: typeof fetch;
816
+ temperature?: number;
817
+ maxOutputTokens?: number;
818
+ reasoningModel?: boolean;
819
+ retry?: ProviderRetryOptions;
820
+ fallbackModel?: string;
821
+ extraBody?: Record<string, JsonValue>;
822
+ appUrl?: string;
823
+ appName?: string;
824
+ };
825
+ declare function openrouter(options: OpenRouterAdapterOptions): ModelAdapter;
826
+
827
+ declare const defaultCloudflareApiBaseUrl = "https://api.cloudflare.com/client/v4";
828
+ type CloudflareWorkersAiAdapterOptions = {
829
+ model: string;
830
+ accountId?: string;
831
+ baseURL?: string;
832
+ apiKey?: string;
833
+ apiKeyName?: string;
834
+ fetchImplementation?: typeof fetch;
835
+ temperature?: number;
836
+ maxOutputTokens?: number;
837
+ retry?: ProviderRetryOptions;
838
+ fallbackModel?: string;
839
+ extraBody?: Record<string, JsonValue>;
840
+ };
841
+ declare function cloudflareWorkersAi(options: CloudflareWorkersAiAdapterOptions): ModelAdapter;
842
+ declare function buildCloudflareWorkersAiChatCompletionsUrl(options: CloudflareWorkersAiAdapterOptions): string;
843
+
844
+ export { type AnthropicAdapterOptions, type AnthropicBatchApiRequest, type AnthropicBatchApiRequestMessage, type AnthropicBatchApiRequestParams, type AnthropicBatchCanceledOutcome, type AnthropicBatchClient, type AnthropicBatchClientOptions, type AnthropicBatchErroredOutcome, type AnthropicBatchExpiredOutcome, type AnthropicBatchMessageRequest, type AnthropicBatchPromptCachingMode, type AnthropicBatchResult, type AnthropicBatchResultOutcome, type AnthropicBatchSubmittedRequestSummary, type AnthropicBatchSucceededOutcome, type AnthropicBatchSystemContentBlock, type AnthropicBatchTraceEventHandler, type AnthropicBatchWaitOptions, type AnthropicCacheControl, type AnthropicCacheTtl, type AnthropicMessageBatch, type AnthropicMessageBatchProcessingStatus, type AnthropicMessageBatchRequestCounts, type AnthropicMessagesResponse, AnthropicMessagesResponseSchema, type AnthropicOutputConfig, type AnthropicPromptCachingMode, type AnthropicPromptCachingOptions, type AnthropicPromptCachingSettings, type AnthropicRequestBody, type AnthropicRequestContentBlock, type AnthropicRequestInput, type AnthropicRequestMessage, type AnthropicRequestSettings, type AnthropicStreamEvent, AnthropicStreamEventSchema, type AnthropicStreamRequestInput, type AnthropicStreamStartUsage, type AnthropicSystemContentBlock, type AnthropicThinkingOptions, type AnthropicToolChoice, type AnthropicToolDefinition, type AnthropicUsage, type AwsCredentials, type AwsSigV4SigningInput, type AzureOpenAiAdapterOptions, type AzureOpenAiChatCompletionResponse, AzureOpenAiChatCompletionResponseSchema, type AzureOpenAiChatRequestBody, type AzureOpenAiStreamRequestBody, type AzureOpenAiStreamRequestInput, type AzureOpenAiUsage, type BedrockAdapterOptions, type BedrockCredentials, type BedrockInvokeModelRequestBody, type ChatCompletionRequest, type ChatCompletionResult, type ChatMessage, type ChatMessageCacheControl, ChatMessageCacheControlSchema, type ChatMessageRole, ChatMessageRoleSchema, ChatMessageSchema, type ChatStopReason, ChatStopReasonSchema, type ChatStreamEvent, type CloudflareWorkersAiAdapterOptions, type GeminiAdapterOptions, type MessageContentBlock, MessageContentBlockSchema, type MockModelOptions, type ModelAdapter, type ModelPricingUsdPerMillionTokens, type ModelToolCall, ModelToolCallSchema, type ModelToolChoice, type ModelToolDefinition, type OpenAiAdapterOptions, type OpenAiCallInput, type OpenAiContentPart, type OpenAiRequestBody, type OpenAiRequestMessage, type OpenAiRequestToolCall, type OpenAiResponseFormat, type OpenAiStructuredOutputMode, type OpenAiToolChoice, type OpenAiToolDefinition, type OpenRouterAdapterOptions, type ProviderExtraBody, type ProviderRetryOptions, type ResolveProviderApiKeyInput, type StructuredOutputRequest, type StructuredOutputResult, anthropic, anthropicBatchJsonOnlySystemInstruction, anthropicBatchTraceWorkflowName, applyCacheControlToLastContentBlock, awsSigV4Algorithm, azureOpenai, bedrock, bedrockAnthropicVersion, buildAnthropicCacheControl, buildAnthropicRequestBody, buildAnthropicStructuredOutputJsonSchema, buildAzureOpenAiChatCompletionsUrl, buildAzureOpenAiChatRequestBody, buildBedrockInvokeModelRequestBody, buildBedrockInvokeModelUrl, buildCloudflareWorkersAiChatCompletionsUrl, buildGeminiResponseSchema, buildOpenAiRequestBody, buildOpenAiStructuredOutputJsonSchema, buildProviderCanceledError, calculateProviderRetryDelayMs, cloudflareWorkersAi, convertZodSchemaToJsonSchema, createAnthropicBatchClient, defaultAnthropicBaseUrl, defaultAnthropicBatchPollIntervalMs, defaultAnthropicBatchTimeoutMs, defaultAnthropicMaxOutputTokens, defaultAzureOpenAiApiVersion, defaultBedrockMaxOutputTokens, defaultCloudflareApiBaseUrl, defaultGeminiBaseUrl, defaultOpenAiBaseUrl, defaultOpenRouterBaseUrl, defaultProviderRetryInitialDelayMs, defaultProviderRetryMaxAttempts, defaultProviderRetryMaxDelayMs, estimateModelCallCostUsd, executeAbortableProviderFetch, executeProviderCallWithModelFallback, executeProviderCallWithRetry, extractAnthropicTextContent, extractAnthropicThinkingText, extractAnthropicToolCalls, extractMessageText, gemini, isAbortError, isOpenAiReasoningModel, isRetryableProviderAppError, isZodV4Schema, joinSystemMessageText, mapAnthropicResponseToChatCompletionResult, mapAnthropicUsageToTokenUsage, mapAzureOpenAiResponseToChatCompletionResult, mapAzureOpenAiUsageToTokenUsage, mapChatMessageToAnthropicRequestMessage, mapChatMessageToOpenAiRequestMessage, mapModelToolChoiceToAnthropicToolChoice, mapModelToolChoiceToOpenAiToolChoice, mapModelToolDefinitionToOpenAiTool, mapModelToolDefinitionsToAnthropicTools, mergeProviderRequestExtraBody, mockModel, normalizeAnthropicStopReason, normalizeAzureOpenAiFinishReason, openAiStructuredOutputSchemaName, openai, openrouter, parseAnthropicBatchStructuredContent, parseAnthropicStreamEvents, parseAnthropicToolInputJson, parseAzureOpenAiStreamEvents, parseAzureOpenAiToolArgumentsJson, prependStructuredOutputJsonOnlySystemMessage, resolveAnthropicPromptCachingSettings, resolveBedrockCredentials, resolveOpenAiStructuredOutputMode, resolveProviderApiKey, sanitizeJsonSchemaForAnthropicStructuredOutput, sanitizeJsonSchemaForGeminiResponseSchema, sanitizeJsonSchemaForOpenAiStructuredOutput, signAwsRequestWithSigV4, streamAnthropicChatCompletion, streamAzureOpenAiChatCompletion, structuredOutputJsonOnlySystemInstruction, structuredOutputJsonOnlySystemMessage };