View Source CHANGELOG
0.5.0 - 2026-07-10
Complete rewrite into an official-SDK-style client. Breaking change across the entire public API — no compatibility shims.
Security
Anthropic.Clientno longer printsapi_keyviainspect/1(@derive {Inspect, except: [:api_key]}) — previously any crash report,Loggermetadata, orIO.inspect/dbgof a client struct leaked the raw key.Anthropic.Batches.results/2now refuses to follow aresults_urlwhose host doesn't matchClient.base_url, so a tampered/malicious API response can't redirect the client'sx-api-keyto an attacker-controlled host.Anthropic.HTTPTransport.Retry.delay_ms/2now capsretry-after-msat 60 seconds (matching the existing cap on theretry-afterseconds header) — previously an unbounded header value could block a caller indefinitely viaProcess.sleep.Anthropic.HTTPTransport.Multipartnow strips CR/LF from a caller-supplied:content_type(as it already did forname/filename), preventing header injection viaAnthropic.Files.create/3/create_from_binary/4.
Fixed
Anthropic.Messages.Content.Image.process_image/2now checks a:pathinput's file size against the API's 5MB image limit viaFile.stat/1before reading it into memory, instead of buffering the whole file first.Anthropic.Batches/Anthropic.FilesnowURI.encode/1path segments built from a caller-supplied id (matchingAnthropic.Models.retrieve/2, which already did).
Changed
- Collapsed
Anthropic.HTTPTransport's duplicatedsend_request/send_rawrequest-attempt-and-retry loops into one (send_raw), removing a documented "keep both in sync" maintenance hazard. mix.exs: addeddocs: [main: "readme", extras: [...]]config so HexDocs gets a proper landing page;package()now declaresfiles:,maintainers:, and a changelog link. Added a top-levelLICENSEfile (Apache-2.0).
Added
:telemetry.span/3around everyAnthropic.HTTPTransportrequest attempt ([:anthropic, :http, :request, :start/:stop/:exception]), coveringcreate/2,count_tokens/2,Models,Batches, andFilesuniformly since they all funnel through the shared transport layer. Metadata includesmethod,url,attempt(retry count), and the resultingstatus.Anthropic.Clientstruct (Client.new/1), replacingAnthropic.Configand the implicit pipeline configuration.- Typed content blocks:
Anthropic.Messages.Content.{Text, ToolUse, ToolResult, Thinking, RedactedThinking, Image}. - Native tool use via the API's real
tools/tool_use/tool_resultprotocol.Anthropic.Tools(JSON Schemainput_schema/0) replacesAnthropic.Tools.ToolBehaviour.Anthropic.ToolRunner.run/4drives the full agentic loop, replacing the hand-rolled XML-in-system-prompt hack. - Streaming:
Anthropic.Messages.stream/2returns a lazyStreamof typedAnthropic.Messages.StreamEventstructs;Anthropic.Messages.stream_to_message/1folds a stream into a finalMessage. Anthropic.Messages.count_tokens/2(POST /v1/messages/count_tokens).Anthropic.Error— a unified error struct/exception mirroring the API's error taxonomy, withretryable?/1.- Automatic retries with exponential backoff (capped at 8s) and jitter on
408/409/429/5xx, honoringretry-after-ms/retry-afterand a server-sentx-should-retryoverride, shared bycreate/2,stream/2, andcount_tokens/2. Anthropic.ModelsandAnthropic.Batchesresources, includingBatches.delete/2and cursor-based auto-pagination (Models.list_all/2,Batches.list_all/2— lazyStreams that transparently walk pages viaafter_id/last_id, backed by the newAnthropic.Paginationhelper).- Prompt caching:
Anthropic.CacheControl.ephemeral/1builds acache_controlmap; attach it to aText/Image/ToolUse/ToolResultcontent block's:cache_controlfield. - Extended thinking request config:
Anthropic.Thinking.enabled/1,.adaptive/1,.disabled/0build a:thinkingparam forMessages.create/2/stream/2. - Structured outputs:
Anthropic.OutputConfig.json_schema/2builds an:output_configparam constraining the response to a given JSON Schema. - PDF/document content blocks:
Anthropic.Messages.Content.Document—process_document/3(local PDF),from_url/2,from_text/2,from_content/2. - Citations: typed response-side citation structs (
Anthropic.Messages.Content.Citation.{CharLocation, PageLocation, ContentBlockLocation, SearchResultLocation, WebSearchResultLocation}), decoded from aTextblock's:citationslist instead of raw maps and re-encoded correctly if replayed into a later request. Request-side config is the existingcitations: %{enabled: true}option onDocument. - Server tools (web search, web fetch, code execution, bash, text editor, memory) — executed by Anthropic server-side, no client
execute/1needed:Anthropic.Tools.{WebSearch, WebFetch, CodeExecution, Bash, TextEditor, Memory}build each tool's versioned wire shape (version:defaults to latest, overridable). Results decode intoAnthropic.Messages.Content.{ServerToolUse, WebSearchToolResult, WebFetchToolResult, CodeExecutionToolResult, BashCodeExecutionToolResult, TextEditorCodeExecutionToolResult}—ServerToolUseis distinct fromToolUsesoAnthropic.ToolRunnernever tries to dispatch a server-tool invocation to a client-side tool. Computer use and the MCP connector are beta-only and not yet supported. Anthropic.Filesresource (beta — automatically sends the requiredanthropic-beta: files-api-2025-04-14header):create/3(local path),create_from_binary/4,list/2,list_all/2,retrieve/2,download/2,delete/2. Backed by newmultipart/form-datasupport inAnthropic.HTTPTransport(post_multipart/4,get_binary/3,Anthropic.HTTPTransport.Multipartencoder) andget/3/delete/3overloads accepting per-request extra headers.- Added
nimble_optionsandmimeas dependencies —nimble_optionsvalidatesCacheControl/Thinking/OutputConfig/server-tool option shapes with clear error messages;mimeguesses a file's content-type from its extension inFiles.create/3.
Removed
Anthropicpipeline API (new/1,add_user_message/2,request_next_message/1,process_invocations/1, etc).Anthropic.Config,Anthropic.Messages.Request/Response(old pipeline versions),Anthropic.HTTPClient,Anthropic.Tools.ToolBehaviour,Anthropic.Tools.Utils(XML tool-calling).
0.4.3 - 2024-03-15
Fixed
- Fixed inconsistency in storing messages in
Anthropic.Request
0.4.2 - 2024-03-15
Fixed
- Prevent to add system message when no
Anthropic.Tools.ToolBehaviouris registered.
0.4.1 - 2024-03-15
Improved
- Removed GenServer from
Anthropic.Config. It will be created fromApplication.get_envor from the supplied options. - Added Mox to test environment.
- Increased test coverage.
Breaking change
- Changed the tool field type to MapSet
Improved
- Better system function concatenation with tools description
- Moved List.reverse from messages to Jason.Encoder implementation.
0.4.0 - 2024-03-13
Improved
- Added tools handling. Now you can register tools that the AI can call, and these calls are automaticaly captured.
Fixed
- The way Messages.content was being generated
Minor
- Moved Response parsing to Request module.
Breaking change
- Replaced
Anthropic.add_image/2withAnthropic.add_user_image/2
0.3.0 - 2024-03-12
Improved
- Included telemetry
- Added threatment of nil
api_key
0.2.1 - 2024-03-11
Fixed
- Removed guard that would not allow assistant message to be added to request
- Process response with Jason.decode.
Improved
- Added type annotations to documentatio
0.2.0 - 2024-03-11
Improved
- Added support for image content