Idiomatic Clojure wrapper over the official Anthropic Java SDK
(com.anthropic/anthropic-java).
Build a request as a Clojure map, get a Clojure map back. The client reads
ANTHROPIC_API_KEY from the environment by default.
Idiomatic Clojure wrapper over the official Anthropic Java SDK (`com.anthropic/anthropic-java`). Build a request as a Clojure map, get a Clojure map back. The client reads `ANTHROPIC_API_KEY` from the environment by default.
(client)(client {:keys [api-key]})An Anthropic client. With no args, resolves credentials from the environment
(ANTHROPIC_API_KEY). Pass {:api-key "..."} to set the key explicitly.
An Anthropic client. With no args, resolves credentials from the environment
(`ANTHROPIC_API_KEY`). Pass `{:api-key "..."}` to set the key explicitly.(create-message client req)Send a Messages request and return the response as a Clojure map.
req keys: :model (string, defaults to "claude-opus-4-8"), :max-tokens
(defaults to 1024), :system (string, optional), and :messages (a seq of
{:role :user|:assistant :content "..."}). Returns
{:id :model :role :stop-reason :content [...] :usage {...}}.
Send a Messages request and return the response as a Clojure map.
`req` keys: `:model` (string, defaults to "claude-opus-4-8"), `:max-tokens`
(defaults to 1024), `:system` (string, optional), and `:messages` (a seq of
`{:role :user|:assistant :content "..."}`). Returns
`{:id :model :role :stop-reason :content [...] :usage {...}}`.(stream-text client req on-text)Stream a Messages request, calling on-text with each text delta (a string)
as it arrives, and returning the full concatenated text when the stream ends.
Takes the same req map as create-message. The underlying HTTP stream is
closed automatically.
Stream a Messages request, calling `on-text` with each text delta (a string) as it arrives, and returning the full concatenated text when the stream ends. Takes the same `req` map as `create-message`. The underlying HTTP stream is closed automatically.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |