## Retrieve Message Batch results

`client.Messages.Batches.Results(ctx, messageBatchID) (*MessageBatchIndividualResponse, error)`

**get** `/v1/messages/batches/{message_batch_id}/results`

Streams the results of a Message Batch as a `.jsonl` file.

Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.

Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)

### Parameters

- `messageBatchID string`

  ID of the Message Batch.

### Returns

- `type MessageBatchIndividualResponse struct{…}`

  This is a single line in the response `.jsonl` file and does not represent the response as a whole.

  - `CustomID string`

    Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

    Must be unique for each request within the Message Batch.

  - `Result MessageBatchResultUnion`

    Processing result for this request.

    Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

    - `type MessageBatchSucceededResult struct{…}`

      - `Message Message`

        - `ID string`

          Unique object identifier.

          The format and length of IDs may change over time.

        - `Container Container`

          Information about the container used in the request (for the code execution tool)

          - `ID string`

            Identifier for the container used in this request

          - `ExpiresAt Time`

            The time at which the container will expire.

        - `Content []ContentBlockUnion`

          Content generated by the model.

          This is an array of content blocks, each of which has a `type` that determines its shape.

          Example:

          ```json
          [{"type": "text", "text": "Hi, I'm Claude."}]
          ```

          If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.

          For example, if the input `messages` were:

          ```json
          [
            {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
            {"role": "assistant", "content": "The best answer is ("}
          ]
          ```

          Then the response `content` might be:

          ```json
          [{"type": "text", "text": "B)"}]
          ```

          - `type TextBlock struct{…}`

            - `Citations []TextCitationUnion`

              Citations supporting the text block.

              The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.

              - `type CitationCharLocation struct{…}`

                - `CitedText string`

                - `DocumentIndex int64`

                - `DocumentTitle string`

                - `EndCharIndex int64`

                - `FileID string`

                - `StartCharIndex int64`

                - `Type CharLocation`

                  - `const CharLocationCharLocation CharLocation = "char_location"`

              - `type CitationPageLocation struct{…}`

                - `CitedText string`

                - `DocumentIndex int64`

                - `DocumentTitle string`

                - `EndPageNumber int64`

                - `FileID string`

                - `StartPageNumber int64`

                - `Type PageLocation`

                  - `const PageLocationPageLocation PageLocation = "page_location"`

              - `type CitationContentBlockLocation struct{…}`

                - `CitedText string`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `DocumentIndex int64`

                - `DocumentTitle string`

                - `EndBlockIndex int64`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `FileID string`

                - `StartBlockIndex int64`

                  0-based index of the first cited block in the source's `content` array.

                - `Type ContentBlockLocation`

                  - `const ContentBlockLocationContentBlockLocation ContentBlockLocation = "content_block_location"`

              - `type CitationsWebSearchResultLocation struct{…}`

                - `CitedText string`

                - `EncryptedIndex string`

                - `Title string`

                - `Type WebSearchResultLocation`

                  - `const WebSearchResultLocationWebSearchResultLocation WebSearchResultLocation = "web_search_result_location"`

                - `URL string`

              - `type CitationsSearchResultLocation struct{…}`

                - `CitedText string`

                  The full text of the cited block range, concatenated.

                  Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.

                - `EndBlockIndex int64`

                  Exclusive 0-based end index of the cited block range in the source's `content` array.

                  Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.

                - `SearchResultIndex int64`

                  0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.

                  Counted separately from `document_index`; server-side web search results are not included in this count.

                - `Source string`

                - `StartBlockIndex int64`

                  0-based index of the first cited block in the source's `content` array.

                - `Title string`

                - `Type SearchResultLocation`

                  - `const SearchResultLocationSearchResultLocation SearchResultLocation = "search_result_location"`

            - `Text string`

            - `Type Text`

              - `const TextText Text = "text"`

          - `type ThinkingBlock struct{…}`

            - `Signature string`

            - `Thinking string`

            - `Type Thinking`

              - `const ThinkingThinking Thinking = "thinking"`

          - `type RedactedThinkingBlock struct{…}`

            - `Data string`

            - `Type RedactedThinking`

              - `const RedactedThinkingRedactedThinking RedactedThinking = "redacted_thinking"`

          - `type ToolUseBlock struct{…}`

            - `ID string`

            - `Caller ToolUseBlockCallerUnion`

              Tool invocation directly from the model.

              - `type DirectCaller struct{…}`

                Tool invocation directly from the model.

                - `Type Direct`

                  - `const DirectDirect Direct = "direct"`

              - `type ServerToolCaller struct{…}`

                Tool invocation generated by a server-side tool.

                - `ToolID string`

                - `Type CodeExecution20250825`

                  - `const CodeExecution20250825CodeExecution20250825 CodeExecution20250825 = "code_execution_20250825"`

              - `type ServerToolCaller20260120 struct{…}`

                - `ToolID string`

                - `Type CodeExecution20260120`

                  - `const CodeExecution20260120CodeExecution20260120 CodeExecution20260120 = "code_execution_20260120"`

            - `Input map[string, any]`

            - `Name string`

            - `Type ToolUse`

              - `const ToolUseToolUse ToolUse = "tool_use"`

          - `type ServerToolUseBlock struct{…}`

            - `ID string`

            - `Caller ServerToolUseBlockCallerUnion`

              Tool invocation directly from the model.

              - `type DirectCaller struct{…}`

                Tool invocation directly from the model.

              - `type ServerToolCaller struct{…}`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120 struct{…}`

            - `Input map[string, any]`

            - `Name ServerToolUseBlockName`

              - `const ServerToolUseBlockNameWebSearch ServerToolUseBlockName = "web_search"`

              - `const ServerToolUseBlockNameWebFetch ServerToolUseBlockName = "web_fetch"`

              - `const ServerToolUseBlockNameCodeExecution ServerToolUseBlockName = "code_execution"`

              - `const ServerToolUseBlockNameBashCodeExecution ServerToolUseBlockName = "bash_code_execution"`

              - `const ServerToolUseBlockNameTextEditorCodeExecution ServerToolUseBlockName = "text_editor_code_execution"`

              - `const ServerToolUseBlockNameToolSearchToolRegex ServerToolUseBlockName = "tool_search_tool_regex"`

              - `const ServerToolUseBlockNameToolSearchToolBm25 ServerToolUseBlockName = "tool_search_tool_bm25"`

            - `Type ServerToolUse`

              - `const ServerToolUseServerToolUse ServerToolUse = "server_tool_use"`

          - `type WebSearchToolResultBlock struct{…}`

            - `Caller WebSearchToolResultBlockCallerUnion`

              Tool invocation directly from the model.

              - `type DirectCaller struct{…}`

                Tool invocation directly from the model.

              - `type ServerToolCaller struct{…}`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120 struct{…}`

            - `Content WebSearchToolResultBlockContentUnion`

              - `type WebSearchToolResultError struct{…}`

                - `ErrorCode WebSearchToolResultErrorCode`

                  - `const WebSearchToolResultErrorCodeInvalidToolInput WebSearchToolResultErrorCode = "invalid_tool_input"`

                  - `const WebSearchToolResultErrorCodeUnavailable WebSearchToolResultErrorCode = "unavailable"`

                  - `const WebSearchToolResultErrorCodeMaxUsesExceeded WebSearchToolResultErrorCode = "max_uses_exceeded"`

                  - `const WebSearchToolResultErrorCodeTooManyRequests WebSearchToolResultErrorCode = "too_many_requests"`

                  - `const WebSearchToolResultErrorCodeQueryTooLong WebSearchToolResultErrorCode = "query_too_long"`

                  - `const WebSearchToolResultErrorCodeRequestTooLarge WebSearchToolResultErrorCode = "request_too_large"`

                - `Type WebSearchToolResultError`

                  - `const WebSearchToolResultErrorWebSearchToolResultError WebSearchToolResultError = "web_search_tool_result_error"`

              - `type WebSearchToolResultBlockContentArray []WebSearchResultBlock`

                - `EncryptedContent string`

                - `PageAge string`

                - `Title string`

                - `Type WebSearchResult`

                  - `const WebSearchResultWebSearchResult WebSearchResult = "web_search_result"`

                - `URL string`

            - `ToolUseID string`

            - `Type WebSearchToolResult`

              - `const WebSearchToolResultWebSearchToolResult WebSearchToolResult = "web_search_tool_result"`

          - `type WebFetchToolResultBlock struct{…}`

            - `Caller WebFetchToolResultBlockCallerUnion`

              Tool invocation directly from the model.

              - `type DirectCaller struct{…}`

                Tool invocation directly from the model.

              - `type ServerToolCaller struct{…}`

                Tool invocation generated by a server-side tool.

              - `type ServerToolCaller20260120 struct{…}`

            - `Content WebFetchToolResultBlockContentUnion`

              - `type WebFetchToolResultErrorBlock struct{…}`

                - `ErrorCode WebFetchToolResultErrorCode`

                  - `const WebFetchToolResultErrorCodeInvalidToolInput WebFetchToolResultErrorCode = "invalid_tool_input"`

                  - `const WebFetchToolResultErrorCodeURLTooLong WebFetchToolResultErrorCode = "url_too_long"`

                  - `const WebFetchToolResultErrorCodeURLNotAllowed WebFetchToolResultErrorCode = "url_not_allowed"`

                  - `const WebFetchToolResultErrorCodeURLNotInPriorContext WebFetchToolResultErrorCode = "url_not_in_prior_context"`

                  - `const WebFetchToolResultErrorCodeURLNotAccessible WebFetchToolResultErrorCode = "url_not_accessible"`

                  - `const WebFetchToolResultErrorCodeUnsupportedContentType WebFetchToolResultErrorCode = "unsupported_content_type"`

                  - `const WebFetchToolResultErrorCodeTooManyRequests WebFetchToolResultErrorCode = "too_many_requests"`

                  - `const WebFetchToolResultErrorCodeMaxUsesExceeded WebFetchToolResultErrorCode = "max_uses_exceeded"`

                  - `const WebFetchToolResultErrorCodeUnavailable WebFetchToolResultErrorCode = "unavailable"`

                - `Type WebFetchToolResultError`

                  - `const WebFetchToolResultErrorWebFetchToolResultError WebFetchToolResultError = "web_fetch_tool_result_error"`

              - `type WebFetchBlock struct{…}`

                - `Content DocumentBlock`

                  - `Citations CitationsConfig`

                    Citation configuration for the document

                    - `Enabled bool`

                  - `Source DocumentBlockSourceUnion`

                    - `type Base64PDFSource struct{…}`

                      - `Data string`

                      - `MediaType ApplicationPDF`

                        - `const ApplicationPDFApplicationPDF ApplicationPDF = "application/pdf"`

                      - `Type Base64`

                        - `const Base64Base64 Base64 = "base64"`

                    - `type PlainTextSource struct{…}`

                      - `Data string`

                      - `MediaType TextPlain`

                        - `const TextPlainTextPlain TextPlain = "text/plain"`

                      - `Type Text`

                        - `const TextText Text = "text"`

                  - `Title string`

                    The title of the document

                  - `Type Document`

                    - `const DocumentDocument Document = "document"`

                - `RetrievedAt string`

                  ISO 8601 timestamp when the content was retrieved

                - `Type WebFetchResult`

                  - `const WebFetchResultWebFetchResult WebFetchResult = "web_fetch_result"`

                - `URL string`

                  Fetched content URL

            - `ToolUseID string`

            - `Type WebFetchToolResult`

              - `const WebFetchToolResultWebFetchToolResult WebFetchToolResult = "web_fetch_tool_result"`

          - `type CodeExecutionToolResultBlock struct{…}`

            - `Content CodeExecutionToolResultBlockContentUnion`

              Code execution result with encrypted stdout for PFC + web_search results.

              - `type CodeExecutionToolResultError struct{…}`

                - `ErrorCode CodeExecutionToolResultErrorCode`

                  - `const CodeExecutionToolResultErrorCodeInvalidToolInput CodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const CodeExecutionToolResultErrorCodeUnavailable CodeExecutionToolResultErrorCode = "unavailable"`

                  - `const CodeExecutionToolResultErrorCodeTooManyRequests CodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const CodeExecutionToolResultErrorCodeExecutionTimeExceeded CodeExecutionToolResultErrorCode = "execution_time_exceeded"`

                - `Type CodeExecutionToolResultError`

                  - `const CodeExecutionToolResultErrorCodeExecutionToolResultError CodeExecutionToolResultError = "code_execution_tool_result_error"`

              - `type CodeExecutionResultBlock struct{…}`

                - `Content []CodeExecutionOutputBlock`

                  - `FileID string`

                  - `Type CodeExecutionOutput`

                    - `const CodeExecutionOutputCodeExecutionOutput CodeExecutionOutput = "code_execution_output"`

                - `ReturnCode int64`

                - `Stderr string`

                - `Stdout string`

                - `Type CodeExecutionResult`

                  - `const CodeExecutionResultCodeExecutionResult CodeExecutionResult = "code_execution_result"`

              - `type EncryptedCodeExecutionResultBlock struct{…}`

                Code execution result with encrypted stdout for PFC + web_search results.

                - `Content []CodeExecutionOutputBlock`

                  - `FileID string`

                  - `Type CodeExecutionOutput`

                - `EncryptedStdout string`

                - `ReturnCode int64`

                - `Stderr string`

                - `Type EncryptedCodeExecutionResult`

                  - `const EncryptedCodeExecutionResultEncryptedCodeExecutionResult EncryptedCodeExecutionResult = "encrypted_code_execution_result"`

            - `ToolUseID string`

            - `Type CodeExecutionToolResult`

              - `const CodeExecutionToolResultCodeExecutionToolResult CodeExecutionToolResult = "code_execution_tool_result"`

          - `type BashCodeExecutionToolResultBlock struct{…}`

            - `Content BashCodeExecutionToolResultBlockContentUnion`

              - `type BashCodeExecutionToolResultError struct{…}`

                - `ErrorCode BashCodeExecutionToolResultErrorCode`

                  - `const BashCodeExecutionToolResultErrorCodeInvalidToolInput BashCodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const BashCodeExecutionToolResultErrorCodeUnavailable BashCodeExecutionToolResultErrorCode = "unavailable"`

                  - `const BashCodeExecutionToolResultErrorCodeTooManyRequests BashCodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const BashCodeExecutionToolResultErrorCodeExecutionTimeExceeded BashCodeExecutionToolResultErrorCode = "execution_time_exceeded"`

                  - `const BashCodeExecutionToolResultErrorCodeOutputFileTooLarge BashCodeExecutionToolResultErrorCode = "output_file_too_large"`

                - `Type BashCodeExecutionToolResultError`

                  - `const BashCodeExecutionToolResultErrorBashCodeExecutionToolResultError BashCodeExecutionToolResultError = "bash_code_execution_tool_result_error"`

              - `type BashCodeExecutionResultBlock struct{…}`

                - `Content []BashCodeExecutionOutputBlock`

                  - `FileID string`

                  - `Type BashCodeExecutionOutput`

                    - `const BashCodeExecutionOutputBashCodeExecutionOutput BashCodeExecutionOutput = "bash_code_execution_output"`

                - `ReturnCode int64`

                - `Stderr string`

                - `Stdout string`

                - `Type BashCodeExecutionResult`

                  - `const BashCodeExecutionResultBashCodeExecutionResult BashCodeExecutionResult = "bash_code_execution_result"`

            - `ToolUseID string`

            - `Type BashCodeExecutionToolResult`

              - `const BashCodeExecutionToolResultBashCodeExecutionToolResult BashCodeExecutionToolResult = "bash_code_execution_tool_result"`

          - `type TextEditorCodeExecutionToolResultBlock struct{…}`

            - `Content TextEditorCodeExecutionToolResultBlockContentUnion`

              - `type TextEditorCodeExecutionToolResultError struct{…}`

                - `ErrorCode TextEditorCodeExecutionToolResultErrorCode`

                  - `const TextEditorCodeExecutionToolResultErrorCodeInvalidToolInput TextEditorCodeExecutionToolResultErrorCode = "invalid_tool_input"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeUnavailable TextEditorCodeExecutionToolResultErrorCode = "unavailable"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeTooManyRequests TextEditorCodeExecutionToolResultErrorCode = "too_many_requests"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeExecutionTimeExceeded TextEditorCodeExecutionToolResultErrorCode = "execution_time_exceeded"`

                  - `const TextEditorCodeExecutionToolResultErrorCodeFileNotFound TextEditorCodeExecutionToolResultErrorCode = "file_not_found"`

                - `ErrorMessage string`

                - `Type TextEditorCodeExecutionToolResultError`

                  - `const TextEditorCodeExecutionToolResultErrorTextEditorCodeExecutionToolResultError TextEditorCodeExecutionToolResultError = "text_editor_code_execution_tool_result_error"`

              - `type TextEditorCodeExecutionViewResultBlock struct{…}`

                - `Content string`

                - `FileType TextEditorCodeExecutionViewResultBlockFileType`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypeText TextEditorCodeExecutionViewResultBlockFileType = "text"`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypeImage TextEditorCodeExecutionViewResultBlockFileType = "image"`

                  - `const TextEditorCodeExecutionViewResultBlockFileTypePDF TextEditorCodeExecutionViewResultBlockFileType = "pdf"`

                - `NumLines int64`

                - `StartLine int64`

                - `TotalLines int64`

                - `Type TextEditorCodeExecutionViewResult`

                  - `const TextEditorCodeExecutionViewResultTextEditorCodeExecutionViewResult TextEditorCodeExecutionViewResult = "text_editor_code_execution_view_result"`

              - `type TextEditorCodeExecutionCreateResultBlock struct{…}`

                - `IsFileUpdate bool`

                - `Type TextEditorCodeExecutionCreateResult`

                  - `const TextEditorCodeExecutionCreateResultTextEditorCodeExecutionCreateResult TextEditorCodeExecutionCreateResult = "text_editor_code_execution_create_result"`

              - `type TextEditorCodeExecutionStrReplaceResultBlock struct{…}`

                - `Lines []string`

                - `NewLines int64`

                - `NewStart int64`

                - `OldLines int64`

                - `OldStart int64`

                - `Type TextEditorCodeExecutionStrReplaceResult`

                  - `const TextEditorCodeExecutionStrReplaceResultTextEditorCodeExecutionStrReplaceResult TextEditorCodeExecutionStrReplaceResult = "text_editor_code_execution_str_replace_result"`

            - `ToolUseID string`

            - `Type TextEditorCodeExecutionToolResult`

              - `const TextEditorCodeExecutionToolResultTextEditorCodeExecutionToolResult TextEditorCodeExecutionToolResult = "text_editor_code_execution_tool_result"`

          - `type ToolSearchToolResultBlock struct{…}`

            - `Content ToolSearchToolResultBlockContentUnion`

              - `type ToolSearchToolResultError struct{…}`

                - `ErrorCode ToolSearchToolResultErrorCode`

                  - `const ToolSearchToolResultErrorCodeInvalidToolInput ToolSearchToolResultErrorCode = "invalid_tool_input"`

                  - `const ToolSearchToolResultErrorCodeUnavailable ToolSearchToolResultErrorCode = "unavailable"`

                  - `const ToolSearchToolResultErrorCodeTooManyRequests ToolSearchToolResultErrorCode = "too_many_requests"`

                  - `const ToolSearchToolResultErrorCodeExecutionTimeExceeded ToolSearchToolResultErrorCode = "execution_time_exceeded"`

                - `ErrorMessage string`

                - `Type ToolSearchToolResultError`

                  - `const ToolSearchToolResultErrorToolSearchToolResultError ToolSearchToolResultError = "tool_search_tool_result_error"`

              - `type ToolSearchToolSearchResultBlock struct{…}`

                - `ToolReferences []ToolReferenceBlock`

                  - `ToolName string`

                  - `Type ToolReference`

                    - `const ToolReferenceToolReference ToolReference = "tool_reference"`

                - `Type ToolSearchToolSearchResult`

                  - `const ToolSearchToolSearchResultToolSearchToolSearchResult ToolSearchToolSearchResult = "tool_search_tool_search_result"`

            - `ToolUseID string`

            - `Type ToolSearchToolResult`

              - `const ToolSearchToolResultToolSearchToolResult ToolSearchToolResult = "tool_search_tool_result"`

          - `type ContainerUploadBlock struct{…}`

            Response model for a file uploaded to the container.

            - `FileID string`

            - `Type ContainerUpload`

              - `const ContainerUploadContainerUpload ContainerUpload = "container_upload"`

        - `Model Model`

          The model that will complete your prompt.

          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

          - `type Model string`

            The model that will complete your prompt.

            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

            - `const ModelClaudeFable5 Model = "claude-fable-5"`

              Next generation of intelligence for the hardest knowledge work and coding problems

            - `const ModelClaudeMythos5 Model = "claude-mythos-5"`

              Most capable model for cybersecurity and biology research

            - `const ModelClaudeOpus4_8 Model = "claude-opus-4-8"`

              Frontier intelligence for long-running agents and coding

            - `const ModelClaudeOpus4_7 Model = "claude-opus-4-7"`

              Frontier intelligence for long-running agents and coding

            - `const ModelClaudeMythosPreview Model = "claude-mythos-preview"`

              New class of intelligence, strongest in coding and cybersecurity

            - `const ModelClaudeOpus4_6 Model = "claude-opus-4-6"`

              Frontier intelligence for long-running agents and coding

            - `const ModelClaudeSonnet4_6 Model = "claude-sonnet-4-6"`

              Best combination of speed and intelligence

            - `const ModelClaudeHaiku4_5 Model = "claude-haiku-4-5"`

              Fastest model with near-frontier intelligence

            - `const ModelClaudeHaiku4_5_20251001 Model = "claude-haiku-4-5-20251001"`

              Fastest model with near-frontier intelligence

            - `const ModelClaudeOpus4_5 Model = "claude-opus-4-5"`

              Premium model combining maximum intelligence with practical performance

            - `const ModelClaudeOpus4_5_20251101 Model = "claude-opus-4-5-20251101"`

              Premium model combining maximum intelligence with practical performance

            - `const ModelClaudeSonnet4_5 Model = "claude-sonnet-4-5"`

              High-performance model for agents and coding

            - `const ModelClaudeSonnet4_5_20250929 Model = "claude-sonnet-4-5-20250929"`

              High-performance model for agents and coding

            - `const ModelClaudeOpus4_1 Model = "claude-opus-4-1"`

              Exceptional model for specialized complex tasks

            - `const ModelClaudeOpus4_1_20250805 Model = "claude-opus-4-1-20250805"`

              Exceptional model for specialized complex tasks

            - `const ModelClaudeOpus4_0 Model = "claude-opus-4-0"`

              Powerful model for complex tasks

            - `const ModelClaudeOpus4_20250514 Model = "claude-opus-4-20250514"`

              Powerful model for complex tasks

            - `const ModelClaudeSonnet4_0 Model = "claude-sonnet-4-0"`

              High-performance model with extended thinking

            - `const ModelClaudeSonnet4_20250514 Model = "claude-sonnet-4-20250514"`

              High-performance model with extended thinking

            - `const ModelClaude_3_Haiku_20240307 Model = "claude-3-haiku-20240307"`

              Fast and cost-effective model

          - `string`

        - `Role Assistant`

          Conversational role of the generated message.

          This will always be `"assistant"`.

          - `const AssistantAssistant Assistant = "assistant"`

        - `StopDetails RefusalStopDetails`

          Structured information about a refusal.

          - `Category RefusalStopDetailsCategory`

            The policy category that triggered the refusal.

            `null` when the refusal doesn't map to a named category.

            - `const RefusalStopDetailsCategoryCyber RefusalStopDetailsCategory = "cyber"`

            - `const RefusalStopDetailsCategoryBio RefusalStopDetailsCategory = "bio"`

            - `const RefusalStopDetailsCategoryReasoningExtraction RefusalStopDetailsCategory = "reasoning_extraction"`

          - `Explanation string`

            Human-readable explanation of the refusal.

            This text is not guaranteed to be stable. `null` when no explanation is available for the category.

          - `Type Refusal`

            - `const RefusalRefusal Refusal = "refusal"`

        - `StopReason StopReason`

          The reason that we stopped.

          This may be one the following values:

          * `"end_turn"`: the model reached a natural stopping point
          * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
          * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
          * `"tool_use"`: the model invoked one or more tools
          * `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.
          * `"refusal"`: when streaming classifiers intervene to handle potential policy violations

          In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.

          - `const StopReasonEndTurn StopReason = "end_turn"`

          - `const StopReasonMaxTokens StopReason = "max_tokens"`

          - `const StopReasonStopSequence StopReason = "stop_sequence"`

          - `const StopReasonToolUse StopReason = "tool_use"`

          - `const StopReasonPauseTurn StopReason = "pause_turn"`

          - `const StopReasonRefusal StopReason = "refusal"`

        - `StopSequence string`

          Which custom stop sequence was generated, if any.

          This value will be a non-null string if one of your custom stop sequences was generated.

        - `Type Message`

          Object type.

          For Messages, this is always `"message"`.

          - `const MessageMessage Message = "message"`

        - `Usage Usage`

          Billing and rate-limit usage.

          Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

          Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.

          For example, `output_tokens` will be non-zero, even for an empty string response from Claude.

          Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.

          - `CacheCreation CacheCreation`

            Breakdown of cached tokens by TTL

            - `Ephemeral1hInputTokens int64`

              The number of input tokens used to create the 1 hour cache entry.

            - `Ephemeral5mInputTokens int64`

              The number of input tokens used to create the 5 minute cache entry.

          - `CacheCreationInputTokens int64`

            The number of input tokens used to create the cache entry.

          - `CacheReadInputTokens int64`

            The number of input tokens read from the cache.

          - `InferenceGeo string`

            The geographic region where inference was performed for this request.

          - `InputTokens int64`

            The number of input tokens which were used.

          - `OutputTokens int64`

            The number of output tokens which were used.

          - `OutputTokensDetails OutputTokensDetails`

            Breakdown of output tokens by category.

            `output_tokens` remains the inclusive, authoritative total used for billing.
            This object provides a read-only decomposition for observability — for example,
            how many of the billed output tokens were spent on internal reasoning that may
            have been summarized before being returned to you.

            - `ThinkingTokens int64`

              Number of output tokens the model generated as internal reasoning, including
              the thinking-block delimiter tokens.

              Reflects the raw reasoning the model produced, not the (possibly shorter)
              summarized thinking text returned in the response body. Computed by
              re-tokenizing the raw reasoning text, so it may differ from the model's exact
              generation count by a small number of tokens. Always ≤ `output_tokens`;
              `output_tokens - thinking_tokens` approximates the non-reasoning output.

          - `ServerToolUse ServerToolUsage`

            The number of server tool requests.

            - `WebFetchRequests int64`

              The number of web fetch tool requests.

            - `WebSearchRequests int64`

              The number of web search tool requests.

          - `ServiceTier UsageServiceTier`

            If the request used the priority, standard, or batch tier.

            - `const UsageServiceTierStandard UsageServiceTier = "standard"`

            - `const UsageServiceTierPriority UsageServiceTier = "priority"`

            - `const UsageServiceTierBatch UsageServiceTier = "batch"`

      - `Type Succeeded`

        - `const SucceededSucceeded Succeeded = "succeeded"`

    - `type MessageBatchErroredResult struct{…}`

      - `Error ErrorResponse`

        - `Error ErrorObjectUnion`

          - `type InvalidRequestError struct{…}`

            - `Message string`

            - `Type InvalidRequestError`

              - `const InvalidRequestErrorInvalidRequestError InvalidRequestError = "invalid_request_error"`

          - `type AuthenticationError struct{…}`

            - `Message string`

            - `Type AuthenticationError`

              - `const AuthenticationErrorAuthenticationError AuthenticationError = "authentication_error"`

          - `type BillingError struct{…}`

            - `Message string`

            - `Type BillingError`

              - `const BillingErrorBillingError BillingError = "billing_error"`

          - `type PermissionError struct{…}`

            - `Message string`

            - `Type PermissionError`

              - `const PermissionErrorPermissionError PermissionError = "permission_error"`

          - `type NotFoundError struct{…}`

            - `Message string`

            - `Type NotFoundError`

              - `const NotFoundErrorNotFoundError NotFoundError = "not_found_error"`

          - `type RateLimitError struct{…}`

            - `Message string`

            - `Type RateLimitError`

              - `const RateLimitErrorRateLimitError RateLimitError = "rate_limit_error"`

          - `type GatewayTimeoutError struct{…}`

            - `Message string`

            - `Type TimeoutError`

              - `const TimeoutErrorTimeoutError TimeoutError = "timeout_error"`

          - `type APIErrorObject struct{…}`

            - `Message string`

            - `Type APIError`

              - `const APIErrorAPIError APIError = "api_error"`

          - `type OverloadedError struct{…}`

            - `Message string`

            - `Type OverloadedError`

              - `const OverloadedErrorOverloadedError OverloadedError = "overloaded_error"`

        - `RequestID string`

        - `Type Error`

          - `const ErrorError Error = "error"`

      - `Type Errored`

        - `const ErroredErrored Errored = "errored"`

    - `type MessageBatchCanceledResult struct{…}`

      - `Type Canceled`

        - `const CanceledCanceled Canceled = "canceled"`

    - `type MessageBatchExpiredResult struct{…}`

      - `Type Expired`

        - `const ExpiredExpired Expired = "expired"`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/anthropics/anthropic-sdk-go"
  "github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
  client := anthropic.NewClient(
    option.WithAPIKey("my-anthropic-api-key"),
  )
  stream := client.Messages.Batches.ResultsStreaming(context.TODO(), "message_batch_id")
  for stream.Next() {
  fmt.Printf("%+v\n", stream.Current())
  }
  err := stream.Err()
  if err != nil {
    panic(err.Error())
  }
}
```
