All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.2.1
Changed
- Loosened req dependency to allow for easier upgrades
0.2.0
Added
ReqAnthropic.RateLimitstruct — parsed fromanthropic-ratelimit-requests-remaining,anthropic-ratelimit-tokens-remaining, andretry-afterheaders on every response. Access it on successful responses viaReqAnthropic.rate_limit/1.ReqAnthropic.RateLimitedexception — returned as{:error, %RateLimited{retry_after: n}}when the API responds with HTTP 429. Theretry_afterfield (seconds) is promoted to the top level for ergonomic pattern matching.ReqAnthropic.rate_limit/1— extracts the%RateLimit{}from a%Req.Response{}'s private data.ReqAnthropic.Errornow carries a:rate_limitfield (%RateLimit{} | nil) populated from response headers on all non-2xx errors.
Changed
- Breaking: HTTP 429 responses now return
{:error, %ReqAnthropic.RateLimited{}}instead of{:error, %ReqAnthropic.Error{type: "rate_limit_error"}}. Callers that pattern-match on%Error{status: 429}or%Error{type: "rate_limit_error"}should update to match%RateLimited{}. The catch-all{:error, exception}pattern is unaffected.
0.1.1
Fixed
- Fixed base URL not being applied to requests. The
auth_stepwas appended after Req's built-input_base_urlstep, so relative paths like/v1/messageswere sent to Finch without a scheme, producingArgumentError: scheme is required for url. The step is now prepended so the base URL is set before Req resolves it. - Set a default
receive_timeoutof 120 seconds inClient.build/1. Finch's 15-second default was too short for LLM API calls, causingReq.TransportError(:closed) on longer requests.
Added
Tools.custom/1now accepts an optional:function(1-arity) thatMessages.run/1will call automatically when the model invokes the tool.Tools.function_map/1— builds a%{name => function}lookup from a list of tool maps.Messages.run/1— sends a message and automatically executes tool calls that have a registered:function, looping until the model produces a final response. Accepts:max_rounds(default 10) to cap the number of round-trips.
0.1.0
Initial release.
Added
ReqAnthropic.attach/2plugin layer for use with any%Req.Request{}, with auth headers, base URL handling, error normalization, and beta header merging.ReqAnthropic.Client.build/1shared builder used by every resource module.- API key resolution from call-site option, application environment, or
the
ANTHROPIC_API_KEYenvironment variable, withReqAnthropic.AuthErrorraised when none are configured. ReqAnthropic.Messages—create/1,count_tokens/1, plus streaming viastream/1,text_deltas/1, andcollect/1.ReqAnthropic.SSE.parse_stream/1— buffered Server-Sent Events parser that handles cross-chunk event boundaries, ping events, and multi-linedata:payloads.ReqAnthropic.Models—list/1,get/2,capabilities/1,clear_cache/0, with results cached in an ETS table owned by the application supervisor.ReqAnthropic.ModelandReqAnthropic.Model.Capabilitiesstructs, including a static capability table for known Claude 4 models.ReqAnthropic.Batches—create/1,get/2,list/1,cancel/2,delete/2, andresults/2with JSONL streaming.ReqAnthropic.Files—create/1(multipart upload),list/1,get/2,delete/2, andcontent/2. Thefiles-api-2025-04-14beta header is added automatically.ReqAnthropic.Tools— builders forweb_search/1,web_fetch/1,bash/1,text_editor/1,computer/1,memory/1,advisor/1, andcustom/1. Tools that require a beta header tag themselves so the resource module can wire it up.ReqAnthropic.Beta— helpers for normalizing, deduping, and merging theanthropic-betaheader value.ReqAnthropic.ErrorandReqAnthropic.AuthErrorexception structs.ReqAnthropic.Agents— full CRUD against/v1/agents, gated behind themanaged-agents-2026-04-01beta header.ReqAnthropic.Environments— full CRUD against/v1/environments.ReqAnthropic.Sessions—create/1,get/2,list/1,archive/2,delete/2,send_events/3,send_message/3,interrupt/2,events/2, andstream/2for the SSE event stream.ReqAnthropic.Vaults— full CRUD plusarchive/2.ReqAnthropic.Vaults.Credentials— nested CRUD plusarchive/3.ReqAnthropic.Conversation— client-side multi-turn helper that holds message history and default request options for repeatedMessagescalls.