langchain4j/docs
Subhash Polisetti 56dc9aa882
Add `AnthropicBatchChatModel` for the Anthropic Message Batches API (#5875)
Progresses #3916.

## Change

Adds `AnthropicBatchChatModel`, an implementation of the core
`BatchChatModel` interface
(`submit` / `retrieve` / `cancel` / `list`) for the [Anthropic Message
Batches
API](https://docs.anthropic.com/en/docs/build-with-claude/batch-processing),
which processes many chat requests asynchronously at 50% of the standard
per-token price.

Each request is built through the same `createAnthropicRequest` path as
`AnthropicChatModel`, so per-request
parameters (tools, thinking, caching, etc.) behave identically in a
batch and in a single call. Results come
back in arbitrary order and are re-sorted to submission order by
generated `custom_id`s. Anthropic reports
only `in_progress` / `canceling` / `ended` at the batch level, so
`ended` maps to `BatchState.SUCCEEDED` and
the per-request `succeeded` / `errored` / `canceled` / `expired`
outcomes are surfaced as `BatchItemResult`s.

The batch endpoints are added to the existing hand-rolled
`AnthropicClient` as default methods that throw
`UnsupportedFeatureException`, so existing `AnthropicClient`
implementations keep compiling. No new
dependency. Chat requests only.

Covered by unit tests against a mock HTTP server (custom-id ordering,
success/error/canceled mapping, the
in-progress case that fetches no results until the batch ends, and
pagination). The integration test
`AnthropicBatchChatModelIT` (key-gated on `ANTHROPIC_API_KEY`) was also
run against the live Batches API and
passes, exercising submit / retrieve / list / cancel.

## General checklist
- [X] There are no breaking changes (API, behaviour)
- [X] I have added unit and/or integration tests for my change
- [X] The tests cover both positive and negative cases
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the core
and main modules, and they are all green
- [X] I have added/updated the documentation
- [ ] I have added an example in the examples repo (only for "big"
features)
- [ ] I have added/updated Spring Boot starter(s) (if applicable)

---------

Co-authored-by: Dmytro Liubarskyi <ljubarskij@gmail.com>
2026-07-30 11:47:48 +02:00
..
docs Add `AnthropicBatchChatModel` for the Anthropic Message Batches API (#5875) 2026-07-30 11:47:48 +02:00
src docs(ehancement): Add spacing to the feature lists (#4254) 2025-12-19 11:07:55 +01:00
static Add tools execution and tokens consumption to agents monitoring (#4737) 2026-03-20 11:37:47 +01:00
.gitignore Added skeleton structure for docs (#458) 2024-01-06 04:01:35 +01:00
.nvmrc site: update npm dependencies (#2062) 2024-11-12 08:17:38 +01:00
Makefile Updated Docs (#500) 2024-01-11 09:04:38 +01:00
README.md site: update npm dependencies (#2062) 2024-11-12 08:17:38 +01:00
babel.config.js Added skeleton structure for docs (#458) 2024-01-06 04:01:35 +01:00
build.sh Docs updates (#599) 2024-02-06 11:13:41 +01:00
docusaurus.config.js docu: added links to the documentation chatbot 2025-01-11 19:35:51 +01:00
package-lock.json chore(deps): bump webpack-dev-server from 5.2.5 to 5.2.6 in /docs (#5834) 2026-07-30 10:36:56 +02:00
package.json chore(deps): update docusaurus monorepo to v3.10.1 (#5181) 2026-05-13 09:45:08 +02:00
sidebars.js Added skeleton structure for docs (#458) 2024-01-06 04:01:35 +01:00
start.bat Docu logos and domain (#503) 2024-01-11 20:37:16 +01:00
start.sh Docs updates (#599) 2024-02-06 11:13:41 +01:00

README.md

LangChain4j Documentation

Table of Contents

This is built using Docusaurus, a modern static docs/website generator.

Prerequisites

If Node.js is managed by Node Version Manager (nvm), run:

nvm use

Installation

This command installs all the Node dependencies.

npm ci

Build

This command builds the deployable static artifacts (i.e., html, js, css, etc) under the build directory. This static content can then be deployed to GitHub pages or Vercel, etc.

npm run build

Local Development

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

npm run start