🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?
Claim this page →
anthropix
Unofficial Anthropic API client for Elixir. Integrate Claude, Anthropic's powerful language model, into your applications.
git clone https://github.com/aaronrussell/anthropix
Anthropix

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.
- ✅ API client fully implementing the Anthropic API
- 🧰 Tool use (function calling)
- 🧠 Extended thinking
- ⚡ Prompt caching
- 📦 Message batching
- 🛜 Streaming API requests
- Stream to an Enumerable
- Or stream messages to any Elixir process
Installation
The package can be installed by adding anthropix to your list of dependencies in mix.exs.
def deps do
[
{:anthropix, "~> 0.6"}
]
end
Quickstart
[!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.client = Anthropix.init(beta: ["output-128k-2025-02-19"])
For more examples, refer to the Anthropix documentation.
Initiate a client.
See Anthropix.init/2.
client = Anthropix.init(api_key)
Chat with Claude
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."
# }], ...}}
Streaming
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.
License
This package is open source and released under the Apache-2 License.
© Copyright 2024 Push Code Ltd.
// compatibility
| Platforms | api |
|---|---|
| Operating systems | — |
| AI compatibility | claude |
| License | Apache-2.0 |
| Pricing | open-source |
| Language | Elixir |
// faq
What is anthropix?
Unofficial Anthropic API client for Elixir. Integrate Claude, Anthropic's powerful language model, into your applications.. It is open-source on GitHub.
Is anthropix free to use?
anthropix is open-source under the Apache-2.0 license, so it is free to use.
What category does anthropix belong to?
anthropix is listed under other in the Claudeers registry of Claude-compatible tools.
// embed badge
[](https://claudeers.com/anthropix)
// retro hit counter
[](https://claudeers.com/anthropix)
// reviews
// guestbook
// related in Frameworks & SDKs
An open-source AI coding agent that lives in your terminal.
Claude Code 泄露源码 - 本地可运行版本,新增跨平台桌面端软件补齐Computer Use(附带核心模块解析)
LangGPT: Empowering everyone to become a prompt expert! 🚀 📌 结构化提示词(Structured Prompt)提出者 📌 元提示词(Meta-Prompt)发起者 📌 最流行的提示词落地范式 | Language of GPT The p…
Multi-Agent Harness for Production AI