Are you the author? Sign in to claim
Unofficial Anthropic API client for Elixir. Integrate Claude, Anthropic's powerful language model, into your application

Anthropix is an open-source Elixir client for the Anthropic API, providing a simple and convenient way to integrate Claude, Anthropic's powerful language model, into your applications.
The package can be installed by adding anthropix to your list of dependencies in mix.exs.
def deps do
[
{:anthropix, "~> 0.6"}
]
end
[!NOTE]
Beta features
Anthropic frequently ship new features under a beta flag, requiring headers to be added to your requests to take advantage of the feature.
If required, beta headers can be added with
init/2.hljs language-elixirclient = Anthropix.init(beta: ["output-128k-2025-02-19"])
For more examples, refer to the Anthropix documentation.
See Anthropix.init/2.
client = Anthropix.init(api_key)
See Anthropix.chat/2.
messages = [
%{role: "user", content: "Why is the sky blue?"},
%{role: "assistant", content: "Due to rayleigh scattering."},
%{role: "user", content: "How is that different than mie scattering?"},
]
Anthropix.chat(client, [
model: "claude-3-opus-20240229",
messages: messages,
])
# {:ok, %{"content" => [%{
# "type" => "text",
# "text" => "Mie scattering affects all wavelengths similarly, while Rayleigh favors shorter ones."
# }], ...}}
A streaming request can be initiated by setting the :stream option.
When :stream is true a lazy t:Enumerable.t/0 is returned which can be used with any Stream functions.
{:ok, stream} = Anthropix.chat(client, [
model: "claude-3-opus-20240229",
messages: messages,
stream: true,
])
# {:ok, #Function<52.53678557/2 in Stream.resource/3>}
stream
|> Stream.each(&update_ui_with_chunk/1)
|> Stream.run()
# :ok
Because the above approach builds the t:Enumerable.t/0 by calling receive, using this approach inside GenServer callbacks may cause the GenServer to misbehave. Setting the :stream option to a t:pid/0 returns a t:Task.t/0 which will send messages to the specified process.
This package is open source and released under the Apache-2 License.
© Copyright 2024 Push Code Ltd.
Manage multiple Claude Code instances in separate git worktrees simultaneously
⚠️ Experimentelle Skill-Sammlung für deutsches Recht (Arbeits-, Gesellschafts-, Insolvenz-, Datenschutz-, Prozessrecht u
Manage multiple Claude Code agents from TUI or Web with tmux and git worktrees
Project management using GitHub Issues + Git worktrees for parallel agent execution