UNPKG

@braintrust/proxy

Version:

A proxy server that load balances across AI providers.

1,768 lines (1,765 loc) 148 kB
import { chatCompletionMessageParamSchema } from '@braintrust/core/typespecs'; import { z } from 'zod'; import { ChatCompletion, ChatCompletionChunk, ChatCompletionCreateParams } from 'openai/resources'; type OpenAIChatCompletionMessage = z.infer<typeof chatCompletionMessageParamSchema>; type OpenAIChatCompletionChoice = ChatCompletion.Choice & { message: OpenAIChatCompletionMessage; }; type OpenAIChatCompletion = ChatCompletion & { choices: Array<OpenAIChatCompletionChoice>; }; declare const chatCompletionMessageReasoningSchema: z.ZodObject<{ id: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>; content: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>; }, "strip", z.ZodTypeAny, { id?: string | undefined; content?: string | undefined; }, { id?: string | null | undefined; content?: string | null | undefined; }>; type OpenAIReasoning = z.infer<typeof chatCompletionMessageReasoningSchema>; type OpenAIChatCompletionChunkChoiceDelta = ChatCompletionChunk.Choice.Delta & { reasoning?: OpenAIReasoning; }; type OpenAIChatCompletionChunkChoice = ChatCompletionChunk.Choice & { delta: OpenAIChatCompletionChunkChoiceDelta; }; type OpenAIChatCompletionChunk = ChatCompletionChunk & { choices: Array<OpenAIChatCompletionChunkChoice>; }; type OpenAIChatCompletionCreateParams = ChatCompletionCreateParams & { messages: Array<OpenAIChatCompletionMessage>; reasoning_enabled?: boolean; reasoning_budget?: number; }; declare module "openai/resources/chat/completions" { interface ChatCompletionCreateParamsBase { reasoning_enabled?: boolean; reasoning_budget?: number; } interface ChatCompletionAssistantMessageParam { reasoning?: OpenAIReasoning[]; } namespace ChatCompletion { interface Choice { reasoning?: OpenAIReasoning[]; } } namespace ChatCompletionChunk { namespace Choice { interface Delta { reasoning?: OpenAIReasoning; } } } } declare const completionUsageSchema: z.ZodObject<{ completion_tokens: z.ZodNumber; prompt_tokens: z.ZodNumber; total_tokens: z.ZodNumber; completion_tokens_details: z.ZodOptional<z.ZodObject<{ accepted_prediction_tokens: z.ZodOptional<z.ZodNumber>; audio_tokens: z.ZodOptional<z.ZodNumber>; reasoning_tokens: z.ZodOptional<z.ZodNumber>; rejected_prediction_tokens: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { accepted_prediction_tokens?: number | undefined; audio_tokens?: number | undefined; reasoning_tokens?: number | undefined; rejected_prediction_tokens?: number | undefined; }, { accepted_prediction_tokens?: number | undefined; audio_tokens?: number | undefined; reasoning_tokens?: number | undefined; rejected_prediction_tokens?: number | undefined; }>>; prompt_tokens_details: z.ZodOptional<z.ZodObject<{ audio_tokens: z.ZodOptional<z.ZodNumber>; cached_tokens: z.ZodOptional<z.ZodNumber>; cache_creation_tokens: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { audio_tokens?: number | undefined; cached_tokens?: number | undefined; cache_creation_tokens?: number | undefined; }, { audio_tokens?: number | undefined; cached_tokens?: number | undefined; cache_creation_tokens?: number | undefined; }>>; }, "strip", z.ZodTypeAny, { completion_tokens: number; prompt_tokens: number; total_tokens: number; completion_tokens_details?: { accepted_prediction_tokens?: number | undefined; audio_tokens?: number | undefined; reasoning_tokens?: number | undefined; rejected_prediction_tokens?: number | undefined; } | undefined; prompt_tokens_details?: { audio_tokens?: number | undefined; cached_tokens?: number | undefined; cache_creation_tokens?: number | undefined; } | undefined; }, { completion_tokens: number; prompt_tokens: number; total_tokens: number; completion_tokens_details?: { accepted_prediction_tokens?: number | undefined; audio_tokens?: number | undefined; reasoning_tokens?: number | undefined; rejected_prediction_tokens?: number | undefined; } | undefined; prompt_tokens_details?: { audio_tokens?: number | undefined; cached_tokens?: number | undefined; cache_creation_tokens?: number | undefined; } | undefined; }>; type OpenAICompletionUsage = z.infer<typeof completionUsageSchema>; declare const anthropicContentPartImageSchema: z.ZodObject<{ type: z.ZodLiteral<"image">; source: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"base64">; media_type: z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/webp"]>; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodEffects<z.ZodString, string, unknown>; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }>; declare const anthropicContentPartSchema: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"image">; source: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"base64">; media_type: z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/webp"]>; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodEffects<z.ZodString, string, unknown>; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"tool_use">; id: z.ZodString; name: z.ZodString; input: z.ZodRecord<z.ZodString, z.ZodAny>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "tool_use"; id: string; name: string; input: Record<string, any>; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "tool_use"; id: string; name: string; input: Record<string, any>; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"tool_result">; tool_use_id: z.ZodString; content: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"image">; source: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"base64">; media_type: z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/webp"]>; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodEffects<z.ZodString, string, unknown>; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }>]>, "many">]>>; is_error: z.ZodOptional<z.ZodBoolean>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "tool_result"; tool_use_id: string; content?: string | ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] | undefined; is_error?: boolean | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "tool_result"; tool_use_id: string; content?: string | ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] | undefined; is_error?: boolean | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"server_tool_use">; id: z.ZodString; name: z.ZodEnum<["web_search", "code_execution"]>; input: z.ZodRecord<z.ZodString, z.ZodAny>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "server_tool_use"; id: string; name: "web_search" | "code_execution"; input: Record<string, any>; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "server_tool_use"; id: string; name: "web_search" | "code_execution"; input: Record<string, any>; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"web_search_tool_result">; tool_use_id: z.ZodString; content: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"web_search_tool_result_error">; errorCode: z.ZodEnum<["invalid_tool_input", "unavailable", "max_uses_exceeded", "too_many_requests", "query_too_long"]>; }, "strip", z.ZodTypeAny, { type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; }, { type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; }>, z.ZodArray<z.ZodObject<{ type: z.ZodLiteral<"web_search_result">; url: z.ZodString; page_age: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; title: z.ZodString; encrypted_content: z.ZodString; }, "strip", z.ZodTypeAny, { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }, { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }>, "many">]>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "web_search_tool_result"; content: ({ type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; } | { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }[]) & ({ type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; } | { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }[] | undefined); tool_use_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "web_search_tool_result"; content: ({ type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; } | { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }[]) & ({ type: "web_search_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long"; } | { type: "web_search_result"; url: string; title: string; encrypted_content: string; page_age?: number | null | undefined; }[] | undefined); tool_use_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"code_execution_tool_result">; tool_use_id: z.ZodString; content: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"code_execution_tool_result_error">; errorCode: z.ZodEnum<["invalid_tool_input", "unavailable", "too_many_requests", "query_too_long"]>; }, "strip", z.ZodTypeAny, { type: "code_execution_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "too_many_requests" | "query_too_long"; }, { type: "code_execution_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "too_many_requests" | "query_too_long"; }>, z.ZodObject<{ type: z.ZodLiteral<"code_execution_result">; return_code: z.ZodNumber; stderr: z.ZodString; stdout: z.ZodString; content: z.ZodArray<z.ZodObject<{ type: z.ZodLiteral<"code_execution_output">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "code_execution_output"; file_id: string; }, { type: "code_execution_output"; file_id: string; }>, "many">; }, "strip", z.ZodTypeAny, { type: "code_execution_result"; content: { type: "code_execution_output"; file_id: string; }[]; return_code: number; stderr: string; stdout: string; }, { type: "code_execution_result"; content: { type: "code_execution_output"; file_id: string; }[]; return_code: number; stderr: string; stdout: string; }>]>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "code_execution_tool_result"; content: { type: "code_execution_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "too_many_requests" | "query_too_long"; } | { type: "code_execution_result"; content: { type: "code_execution_output"; file_id: string; }[]; return_code: number; stderr: string; stdout: string; }; tool_use_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "code_execution_tool_result"; content: { type: "code_execution_tool_result_error"; errorCode: "invalid_tool_input" | "unavailable" | "too_many_requests" | "query_too_long"; } | { type: "code_execution_result"; content: { type: "code_execution_output"; file_id: string; }[]; return_code: number; stderr: string; stdout: string; }; tool_use_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"mcp_tool_use">; id: z.ZodString; name: z.ZodString; input: z.ZodRecord<z.ZodString, z.ZodAny>; server_name: z.ZodString; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "mcp_tool_use"; id: string; name: string; input: Record<string, any>; server_name: string; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "mcp_tool_use"; id: string; name: string; input: Record<string, any>; server_name: string; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"mcp_tool_result">; tool_use_id: z.ZodString; is_error: z.ZodBoolean; content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; citations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">>>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }>, "many">]>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "mcp_tool_result"; content: (string | { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }[]) & (string | { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }[] | undefined); tool_use_id: string; is_error: boolean; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "mcp_tool_result"; content: (string | { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }[]) & (string | { type: "text"; text: string; citations?: Record<string, any>[] | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }[] | undefined); tool_use_id: string; is_error: boolean; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"document">; source: z.ZodUnion<[z.ZodObject<{ media_type: z.ZodLiteral<"application/pdf">; data: z.ZodString; type: z.ZodLiteral<"base64">; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "application/pdf"; }, { type: "base64"; data: string; media_type: "application/pdf"; }>, z.ZodObject<{ media_type: z.ZodLiteral<"text/plain">; data: z.ZodString; type: z.ZodLiteral<"text">; }, "strip", z.ZodTypeAny, { type: "text"; data: string; media_type: "text/plain"; }, { type: "text"; data: string; media_type: "text/plain"; }>, z.ZodObject<{ url: z.ZodString; type: z.ZodLiteral<"url">; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url: string; }>, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"image">; source: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"base64">; media_type: z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/webp"]>; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodEffects<z.ZodString, string, unknown>; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }>]>, "many">]>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; citations: z.ZodOptional<z.ZodObject<{ enabled: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { enabled?: boolean | undefined; }, { enabled?: boolean | undefined; }>>; context: z.ZodOptional<z.ZodNullable<z.ZodString>>; title: z.ZodOptional<z.ZodNullable<z.ZodString>>; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "document"; source: string | { type: "file"; file_id: string; } | ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] | { type: "base64"; data: string; media_type: "application/pdf"; } | { type: "text"; data: string; media_type: "text/plain"; } | { type: "url"; url: string; } | (string & { type: "file"; file_id: string; }) | (string & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | (string & { type: "base64"; data: string; media_type: "application/pdf"; }) | (string & { type: "text"; data: string; media_type: "text/plain"; }) | (string & { type: "url"; url: string; }) | ({ type: "file"; file_id: string; } & string) | ({ type: "file"; file_id: string; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & string) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "file"; file_id: string; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "base64"; data: string; media_type: "application/pdf"; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "text"; data: string; media_type: "text/plain"; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "url"; url: string; }) | ({ type: "base64"; data: string; media_type: "application/pdf"; } & string) | ({ type: "base64"; data: string; media_type: "application/pdf"; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | ({ type: "text"; data: string; media_type: "text/plain"; } & string) | ({ type: "text"; data: string; media_type: "text/plain"; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | ({ type: "url"; url: string; } & string) | ({ type: "url"; url: string; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]); citations?: { enabled?: boolean | undefined; } | undefined; context?: string | null | undefined; title?: string | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "document"; source: string | { type: "file"; file_id: string; } | ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] | { type: "base64"; data: string; media_type: "application/pdf"; } | { type: "text"; data: string; media_type: "text/plain"; } | { type: "url"; url: string; } | (string & { type: "file"; file_id: string; }) | (string & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | (string & { type: "base64"; data: string; media_type: "application/pdf"; }) | (string & { type: "text"; data: string; media_type: "text/plain"; }) | (string & { type: "url"; url: string; }) | ({ type: "file"; file_id: string; } & string) | ({ type: "file"; file_id: string; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & string) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "file"; file_id: string; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "base64"; data: string; media_type: "application/pdf"; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "text"; data: string; media_type: "text/plain"; }) | (({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[] & { type: "url"; url: string; }) | ({ type: "base64"; data: string; media_type: "application/pdf"; } & string) | ({ type: "base64"; data: string; media_type: "application/pdf"; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | ({ type: "text"; data: string; media_type: "text/plain"; } & string) | ({ type: "text"; data: string; media_type: "text/plain"; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]) | ({ type: "url"; url: string; } & string) | ({ type: "url"; url: string; } & ({ type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; } | { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; })[]); citations?: { enabled?: boolean | undefined; } | undefined; context?: string | null | undefined; title?: string | null | undefined; cache_control?: { type: "ephemeral"; } | null | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"thinking">; thinking: z.ZodString; signature: z.ZodString; }, "strip", z.ZodTypeAny, { type: "thinking"; thinking: string; signature: string; }, { type: "thinking"; thinking: string; signature: string; }>, z.ZodObject<{ type: z.ZodLiteral<"redacted_thinking">; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "redacted_thinking"; data: string; }, { type: "redacted_thinking"; data: string; }>, z.ZodObject<{ type: z.ZodLiteral<"container_upload">; file_id: z.ZodString; cache_control: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>>; }, "strip", z.ZodTypeAny, { type: "container_upload"; file_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }, { type: "container_upload"; file_id: string; cache_control?: { type: "ephemeral"; } | null | undefined; }>]>; declare const anthropicMessageParamSchema: z.ZodObject<{ role: z.ZodEnum<["system", "user", "assistant"]>; content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"text">; text: z.ZodString; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "text"; text: string; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"image">; source: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"base64">; media_type: z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/webp"]>; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }, { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; }>, z.ZodObject<{ type: z.ZodLiteral<"url">; url: z.ZodEffects<z.ZodString, string, unknown>; }, "strip", z.ZodTypeAny, { type: "url"; url: string; }, { type: "url"; url?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"file">; file_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: "file"; file_id: string; }, { type: "file"; file_id: string; }>]>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url: string; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "image"; source: { type: "base64"; data: string; media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp"; } | { type: "url"; url?: unknown; } | { type: "file"; file_id: string; }; cache_control?: { type: "ephemeral"; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"tool_use">; id: z.ZodString; name: z.ZodString; input: z.ZodRecord<z.ZodString, z.ZodAny>; cache_control: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<["ephemeral"]>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; }, { type: "ephemeral"; }>>; }, "strip", z.ZodTypeAny, { type: "tool_use"; id: string; name: string; input: Record<string, any>; cache_control?: { type: "ephemeral"; } | undefined; }, { type: "tool_use"; id: string;