import * as z from "zod/v4"; import * as discriminatedUnionTypes from "../types/discriminatedUnion.js"; import { ClosedEnum, OpenEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { AnthropicCacheCreation } from "./anthropiccachecreation.js"; import { AnthropicContainer } from "./anthropiccontainer.js"; import { AnthropicInputTransformation } from "./anthropicinputtransformation.js"; import { AnthropicOutputTokensDetails } from "./anthropicoutputtokensdetails.js"; import { AnthropicRefusalStopDetails } from "./anthropicrefusalstopdetails.js"; import { AnthropicServerToolUsage } from "./anthropicservertoolusage.js"; import { AnthropicServiceTier } from "./anthropicservicetier.js"; import { AnthropicSpeed } from "./anthropicspeed.js"; import { AnthropicUsageIteration } from "./anthropicusageiteration.js"; import { ApiErrorType } from "./apierrortype.js"; import { CostDetails } from "./costdetails.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { FinishReason } from "./finishreason.js"; import { OpenResponsesResult } from "./openresponsesresult.js"; import { OpenRouterMetadata } from "./openroutermetadata.js"; import { ORAnthropicContentBlock } from "./oranthropiccontentblock.js"; import { ORAnthropicStopReason } from "./oranthropicstopreason.js"; import { ReasoningDetailEncrypted } from "./reasoningdetailencrypted.js"; import { ReasoningDetailServerToolCall } from "./reasoningdetailservertoolcall.js"; import { ReasoningDetailSummary } from "./reasoningdetailsummary.js"; import { ReasoningDetailText } from "./reasoningdetailtext.js"; export declare const BatchObjectCompletionWindow: { readonly TwentyFourh: "24h"; }; export type BatchObjectCompletionWindow = ClosedEnum; export type BatchObjectError = { message: string; }; export declare const BatchObjectObjectBatch: { readonly Batch: "batch"; }; export type BatchObjectObjectBatch = ClosedEnum; export type BatchObjectRequestCounts = { completed: number; failed: number; total: number; }; export type ResultError = { /** * Canonical OpenRouter error type, stable across all API formats */ errorType?: ApiErrorType | undefined; message: string; param: string | null; type: string; }; /** * Embedding vector as an array of floats or a base64 string */ export type Embedding = Array | string; export declare const ObjectEmbedding: { readonly Embedding: "embedding"; }; export type ObjectEmbedding = ClosedEnum; /** * A single embedding object */ export type BatchObjectData = { /** * Embedding vector as an array of floats or a base64 string */ embedding: Array | string; /** * Index of the embedding in the input list */ index?: number | undefined; object: ObjectEmbedding; }; export declare const BodyObjectList: { readonly List: "list"; }; export type BodyObjectList = ClosedEnum; /** * Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. */ export type BodyPromptTokensDetails2 = { /** * Number of audio tokens in the input */ audioTokens?: number | undefined; /** * Number of file/document tokens in the input */ fileTokens?: number | undefined; /** * Number of image tokens in the input */ imageTokens?: number | undefined; /** * Number of text tokens in the input */ textTokens?: number | undefined; /** * Number of video tokens in the input */ videoTokens?: number | undefined; }; /** * Token usage statistics */ export type BodyUsage3 = { /** * Cost of the request in credits */ cost?: number | undefined; /** * Breakdown of upstream inference costs */ costDetails?: CostDetails | null | undefined; /** * Whether a request was made using a Bring Your Own Key configuration */ isByok?: boolean | undefined; /** * Number of tokens in the input */ promptTokens: number; /** * Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included. */ promptTokensDetails?: BodyPromptTokensDetails2 | undefined; /** * Total number of tokens used */ totalTokens: number; }; /** * Embeddings response containing embedding vectors */ export type BodyList = { /** * List of embedding objects */ data: Array; /** * Unique identifier for the embeddings response */ id?: string | undefined; /** * The model used for embeddings */ model: string; object: BodyObjectList; /** * Token usage statistics */ usage?: BodyUsage3 | undefined; }; export declare const BatchObjectRole: { readonly Assistant: "assistant"; }; export type BatchObjectRole = ClosedEnum; export declare const BatchObjectTypeMessage: { readonly Message: "message"; }; export type BatchObjectTypeMessage = ClosedEnum; export type BodyUsage2 = { cacheCreation: AnthropicCacheCreation | null; cacheCreationInputTokens: number | null; cacheReadInputTokens: number | null; inferenceGeo: string | null; inputTokens: number; outputTokens: number; outputTokensDetails: AnthropicOutputTokensDetails | null; serverToolUse: AnthropicServerToolUsage | null; serviceTier: AnthropicServiceTier | null; iterations?: Array | undefined; speed?: AnthropicSpeed | null | undefined; }; export type BodyMessage = { container: AnthropicContainer | null; content: Array; id: string; inputTransformations?: Array | null | undefined; model: string; role: BatchObjectRole; /** * Structured information about a refusal */ stopDetails: AnthropicRefusalStopDetails | null; stopReason: ORAnthropicStopReason | null; stopSequence: string | null; type: BatchObjectTypeMessage; usage: BodyUsage2; }; export type ContentTopLogprob = { bytes: Array | null; logprob: number; token: string; }; export type LogprobsContent = { bytes: Array | null; logprob: number; token: string; topLogprobs: Array; }; export type RefusalTopLogprob = { bytes: Array | null; logprob: number; token: string; }; export type Refusal = { bytes: Array | null; logprob: number; token: string; topLogprobs: Array; }; export type Logprobs = { content: Array | null; refusal?: Array | null | undefined; }; export type WebSearchCitation = { citedText?: string | undefined; encryptedIndex?: string | undefined; title: string | null; url: string; }; export type AnnotationWebSearchCitation = { type: "web_search_citation"; webSearchCitation: WebSearchCitation; }; export type BatchObjectUrlCitation = { content?: string | undefined; endIndex: number; startIndex: number; title: string; url: string; }; export type AnnotationURLCitation = { type: "url_citation"; urlCitation: BatchObjectUrlCitation; }; export type ContentImageUrlImageUrl = { url: string; }; export type ContentImageURL = { imageUrl: ContentImageUrlImageUrl; type: "image_url"; }; export type ContentText = { text: string; type: "text"; }; export type AnnotationContentUnion = ContentText | ContentImageURL | discriminatedUnionTypes.Unknown<"type">; export type BatchObjectFile = { content: Array>; hash: string; name?: string | undefined; }; export type AnnotationFile = { file: BatchObjectFile; type: "file"; }; export type Annotation = AnnotationFile | AnnotationURLCitation | AnnotationWebSearchCitation | discriminatedUnionTypes.Unknown<"type">; export type BatchObjectImageUrl = { url: string; }; export declare const ChoiceTypeImageURLEnum: { readonly ImageUrl: "image_url"; }; export type ChoiceTypeImageURLEnum = ClosedEnum; export type Image = { imageUrl: BatchObjectImageUrl; type: ChoiceTypeImageURLEnum; }; export type ReasoningDetail = ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText | ReasoningDetailServerToolCall | discriminatedUnionTypes.Unknown<"type">; export declare const ChoiceRole: { readonly Assistant: "assistant"; }; export type ChoiceRole = ClosedEnum; export type BatchObjectFunction = { arguments: string; name: string; }; export declare const ChoiceTypeFunction: { readonly Function: "function"; }; export type ChoiceTypeFunction = ClosedEnum; export type ToolCall = { function: BatchObjectFunction; id: string; index: number; type: ChoiceTypeFunction; }; export type Message = { annotations?: Array> | undefined; content: string | null; images?: Array | null | undefined; reasoning?: string | null | undefined; reasoningDetails?: Array | null> | null | undefined; refusal: string | null; role: ChoiceRole; toolCalls?: Array | undefined; }; export type Choice = { finishReason: FinishReason; index: number; logprobs: Logprobs | null; message: Message; nativeFinishReason: string | null; }; export declare const BatchObjectEvent: { readonly AdapterRequest: "adapter_request"; readonly UpstreamHeadersReceived: "upstream_headers_received"; readonly FirstTokenReceived: "first_token_received"; readonly UpstreamBodyEnded: "upstream_body_ended"; }; export type BatchObjectEvent = OpenEnum; export type BatchObjectTimings = { epochMs: number; event: BatchObjectEvent; startMs: number; }; export type BatchObjectDebug = { echoUpstreamBody?: { [k: string]: any; } | undefined; timings?: BatchObjectTimings | undefined; additionalProperties?: { [k: string]: any; } | undefined; }; export declare const BodyObjectChatCompletion: { readonly ChatCompletion: "chat.completion"; }; export type BodyObjectChatCompletion = ClosedEnum; export type BodyCompletionTokensDetails = { /** * Tokens generated by the model for audio output. */ audioTokens?: number | null | undefined; /** * Tokens generated by the model for image output. */ imageTokens?: number | null | undefined; /** * Tokens generated by the model for reasoning. */ reasoningTokens?: number | null | undefined; }; /** * Breakdown of tokens used in the prompt. */ export type BodyPromptTokensDetails1 = { /** * Tokens used for input audio. */ audioTokens?: number | null | undefined; /** * Tokens written to cache. Only returned for models with explicit caching and cache write pricing. */ cacheWriteTokens?: number | null | undefined; /** * Tokens cached by the endpoint. */ cachedTokens?: number | null | undefined; /** * Tokens used for input files/documents. */ fileTokens?: number | null | undefined; /** * Tokens used for input video. */ videoTokens?: number | null | undefined; }; /** * Usage for server-side tool execution (e.g., web search) */ export type BodyServerToolUse = { /** * Number of OpenRouter server tool calls that executed and produced a result. */ toolCallsExecuted?: number | null | undefined; /** * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. */ toolCallsRequested?: number | null | undefined; /** * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. */ webSearchRequests?: number | null | undefined; }; /** * Usage for server-side tool execution (e.g., web search) */ export type BatchObjectServerToolUseDetails = { /** * Number of OpenRouter server tool calls that executed and produced a result. */ toolCallsExecuted?: number | null | undefined; /** * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. */ toolCallsRequested?: number | null | undefined; /** * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. */ webSearchRequests?: number | null | undefined; }; export type BodyUsage1 = { /** * The tokens generated */ completionTokens: number; completionTokensDetails?: BodyCompletionTokensDetails | null | undefined; /** * Including images, input audio, and tools if any */ promptTokens: number; /** * Breakdown of tokens used in the prompt. */ promptTokensDetails?: BodyPromptTokensDetails1 | null | undefined; /** * Usage for server-side tool execution (e.g., web search) */ serverToolUse?: BodyServerToolUse | null | undefined; /** * Usage for server-side tool execution (e.g., web search) */ serverToolUseDetails?: BatchObjectServerToolUseDetails | null | undefined; /** * Sum of the above two fields */ totalTokens: number; }; export type BodyChatCompletion = { choices: Array; created: number; debug?: BatchObjectDebug | undefined; id: string; model: string; object: BodyObjectChatCompletion; openrouterMetadata?: OpenRouterMetadata | undefined; provider?: string | null | undefined; serviceTier?: string | null | undefined; systemFingerprint?: string | null | undefined; usage?: BodyUsage1 | undefined; }; export type Body = OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList; export type BatchObjectResponse = { body: OpenResponsesResult | BodyMessage | BodyChatCompletion | BodyList; requestId: string | null; statusCode: number; }; export type Result = { customId: string; error: ResultError | null; id: string; response: BatchObjectResponse | null; }; export declare const BatchObjectStatus: { readonly Validating: "validating"; readonly InProgress: "in_progress"; readonly Finalizing: "finalizing"; readonly Completed: "completed"; readonly Failed: "failed"; readonly Expired: "expired"; readonly Cancelling: "cancelling"; readonly Cancelled: "cancelled"; }; export type BatchObjectStatus = OpenEnum; export type BatchObjectCompletionTokensDetails = { /** * Tokens generated by the model for audio output. */ audioTokens?: number | null | undefined; /** * Tokens generated by the model for image output. */ imageTokens?: number | null | undefined; /** * Tokens generated by the model for reasoning. */ reasoningTokens?: number | null | undefined; }; /** * Breakdown of tokens used in the prompt. */ export type BatchObjectPromptTokensDetails = { /** * Tokens used for input audio. */ audioTokens?: number | null | undefined; /** * Tokens written to cache. Only returned for models with explicit caching and cache write pricing. */ cacheWriteTokens?: number | null | undefined; /** * Tokens cached by the endpoint. */ cachedTokens?: number | null | undefined; /** * Tokens used for input files/documents. */ fileTokens?: number | null | undefined; /** * Tokens used for input video. */ videoTokens?: number | null | undefined; }; /** * Usage for server-side tool execution (e.g., web search) */ export type BatchObjectServerToolUse = { /** * Number of OpenRouter server tool calls that executed and produced a result. */ toolCallsExecuted?: number | null | undefined; /** * Total number of OpenRouter server-orchestrated tool calls the model requested, across all tool types. Provider-native tools (e.g. native web search) are not counted here. */ toolCallsRequested?: number | null | undefined; /** * Number of web searches performed by server-side tools. For server-orchestrated tool calls a web search is also counted in tool_calls_requested; provider-native web search may report web_search_requests only. Do not sum the two. */ webSearchRequests?: number | null | undefined; }; export type BatchObjectUsage = { cacheCreation?: AnthropicCacheCreation | null | undefined; /** * The tokens generated */ completionTokens: number; completionTokensDetails?: BatchObjectCompletionTokensDetails | null | undefined; /** * Cost of the completion */ cost?: number | null | undefined; /** * Breakdown of upstream inference costs */ costDetails?: CostDetails | null | undefined; /** * Whether a request was made using a Bring Your Own Key configuration */ isByok?: boolean | undefined; iterations?: Array | null | undefined; /** * Including images, input audio, and tools if any */ promptTokens: number; /** * Breakdown of tokens used in the prompt. */ promptTokensDetails?: BatchObjectPromptTokensDetails | null | undefined; /** * Usage for server-side tool execution (e.g., web search) */ serverToolUse?: BatchObjectServerToolUse | null | undefined; /** * The service tier used by the upstream provider for this request */ serviceTier?: string | null | undefined; speed?: AnthropicSpeed | null | undefined; /** * Sum of the above two fields */ totalTokens: number; }; export type BatchObject = { completionWindow: BatchObjectCompletionWindow; createdAt: number; endpoint: string; error: BatchObjectError | null; finalizedAt: number | null; id: string; model: string; object: BatchObjectObjectBatch; requestCounts: BatchObjectRequestCounts; results: Array | null; status: BatchObjectStatus; usage: BatchObjectUsage | null; }; /** @internal */ export declare const BatchObjectCompletionWindow$inboundSchema: z.ZodEnum; /** @internal */ export declare const BatchObjectError$inboundSchema: z.ZodType; export declare function batchObjectErrorFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectObjectBatch$inboundSchema: z.ZodEnum; /** @internal */ export declare const BatchObjectRequestCounts$inboundSchema: z.ZodType; export declare function batchObjectRequestCountsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ResultError$inboundSchema: z.ZodType; export declare function resultErrorFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Embedding$inboundSchema: z.ZodType; export declare function embeddingFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ObjectEmbedding$inboundSchema: z.ZodEnum; /** @internal */ export declare const BatchObjectData$inboundSchema: z.ZodType; export declare function batchObjectDataFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyObjectList$inboundSchema: z.ZodEnum; /** @internal */ export declare const BodyPromptTokensDetails2$inboundSchema: z.ZodType; export declare function bodyPromptTokensDetails2FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyUsage3$inboundSchema: z.ZodType; export declare function bodyUsage3FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyList$inboundSchema: z.ZodType; export declare function bodyListFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectRole$inboundSchema: z.ZodEnum; /** @internal */ export declare const BatchObjectTypeMessage$inboundSchema: z.ZodEnum; /** @internal */ export declare const BodyUsage2$inboundSchema: z.ZodType; export declare function bodyUsage2FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyMessage$inboundSchema: z.ZodType; export declare function bodyMessageFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ContentTopLogprob$inboundSchema: z.ZodType; export declare function contentTopLogprobFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const LogprobsContent$inboundSchema: z.ZodType; export declare function logprobsContentFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const RefusalTopLogprob$inboundSchema: z.ZodType; export declare function refusalTopLogprobFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Refusal$inboundSchema: z.ZodType; export declare function refusalFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Logprobs$inboundSchema: z.ZodType; export declare function logprobsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const WebSearchCitation$inboundSchema: z.ZodType; export declare function webSearchCitationFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const AnnotationWebSearchCitation$inboundSchema: z.ZodType; export declare function annotationWebSearchCitationFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectUrlCitation$inboundSchema: z.ZodType; export declare function batchObjectUrlCitationFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const AnnotationURLCitation$inboundSchema: z.ZodType; export declare function annotationURLCitationFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ContentImageUrlImageUrl$inboundSchema: z.ZodType; export declare function contentImageUrlImageUrlFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ContentImageURL$inboundSchema: z.ZodType; export declare function contentImageURLFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ContentText$inboundSchema: z.ZodType; export declare function contentTextFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const AnnotationContentUnion$inboundSchema: z.ZodType; export declare function annotationContentUnionFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectFile$inboundSchema: z.ZodType; export declare function batchObjectFileFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const AnnotationFile$inboundSchema: z.ZodType; export declare function annotationFileFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Annotation$inboundSchema: z.ZodType; export declare function annotationFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectImageUrl$inboundSchema: z.ZodType; export declare function batchObjectImageUrlFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ChoiceTypeImageURLEnum$inboundSchema: z.ZodEnum; /** @internal */ export declare const Image$inboundSchema: z.ZodType; export declare function imageFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ReasoningDetail$inboundSchema: z.ZodType; export declare function reasoningDetailFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ChoiceRole$inboundSchema: z.ZodEnum; /** @internal */ export declare const BatchObjectFunction$inboundSchema: z.ZodType; export declare function batchObjectFunctionFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const ChoiceTypeFunction$inboundSchema: z.ZodEnum; /** @internal */ export declare const ToolCall$inboundSchema: z.ZodType; export declare function toolCallFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Message$inboundSchema: z.ZodType; export declare function messageFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Choice$inboundSchema: z.ZodType; export declare function choiceFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectEvent$inboundSchema: z.ZodType; /** @internal */ export declare const BatchObjectTimings$inboundSchema: z.ZodType; export declare function batchObjectTimingsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectDebug$inboundSchema: z.ZodType; export declare function batchObjectDebugFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyObjectChatCompletion$inboundSchema: z.ZodEnum; /** @internal */ export declare const BodyCompletionTokensDetails$inboundSchema: z.ZodType; export declare function bodyCompletionTokensDetailsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyPromptTokensDetails1$inboundSchema: z.ZodType; export declare function bodyPromptTokensDetails1FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyServerToolUse$inboundSchema: z.ZodType; export declare function bodyServerToolUseFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectServerToolUseDetails$inboundSchema: z.ZodType; export declare function batchObjectServerToolUseDetailsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyUsage1$inboundSchema: z.ZodType; export declare function bodyUsage1FromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BodyChatCompletion$inboundSchema: z.ZodType; export declare function bodyChatCompletionFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Body$inboundSchema: z.ZodType; export declare function bodyFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectResponse$inboundSchema: z.ZodType; export declare function batchObjectResponseFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const Result$inboundSchema: z.ZodType; export declare function resultFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectStatus$inboundSchema: z.ZodType; /** @internal */ export declare const BatchObjectCompletionTokensDetails$inboundSchema: z.ZodType; export declare function batchObjectCompletionTokensDetailsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectPromptTokensDetails$inboundSchema: z.ZodType; export declare function batchObjectPromptTokensDetailsFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectServerToolUse$inboundSchema: z.ZodType; export declare function batchObjectServerToolUseFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObjectUsage$inboundSchema: z.ZodType; export declare function batchObjectUsageFromJSON(jsonString: string): SafeParseResult; /** @internal */ export declare const BatchObject$inboundSchema: z.ZodType; export declare function batchObjectFromJSON(jsonString: string): SafeParseResult; //# sourceMappingURL=batchobject.d.ts.map