cd /news/large-language-models/show-hn-erlangchain-a-tiny-erlang-cl… · home topics large-language-models article
[ARTICLE · art-46194] src=github.com ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Show HN: Erlangchain – A tiny Erlang client for LLMs

Developer abhavk released Erlangchain, a minimal Erlang client for LLMs with zero third-party dependencies, supporting OpenAI and Anthropic APIs, tool use, and multimodal inputs. The open-source library provides a simple chat interface and built-in JSON utilities, aiming to bring LLM integration to the Erlang ecosystem.

read1 min views1 publishedJul 1, 2026
Show HN: Erlangchain – A tiny Erlang client for LLMs
Image: source

Minimal building blocks for talking to LLMs from Erlang, with zero third-party dependencies (only OTP inets

  • ssl

).

Module Role
llm
one-call chat client for OpenAI (Responses API) and Anthropic, with tool-use and multimodal support
json_util
dependency-free JSON encode/decode
%% rebar.config
{deps, [
    {erlangchain, {git, "https://github.com/abhavk/erlangchain.git", {tag, "0.1.0"}}}
]}.

Set OPENAI_API_KEY

and/or ANTHROPIC_API_KEY

in the environment (a .env

file in the working directory is loaded automatically if present).

%% Simple completion (defaults to openai/small):
{ok, #{content := Text}} = llm:chat([#{role => user, content => <<"hello">>}]),

%% Pick provider + size:
{ok, Resp} = llm:chat(openai, big, Messages),

%% Tool use — pass tool specs, get back tool_calls to run and feed back:
{ok, #{tool_calls := Calls}} = llm:chat(openai, big, Messages, Tools).

Messages

are maps like #{role => system|user|assistant, content => binary()}

, plus #{role => tool_result, tool_use_id => Id, content => Bin}

to return tool output. See the header of src/llm.erl

for the full message/response shapes.

<<"{\"a\":1}">> = json_util:encode(#{<<"a">> => 1}),
#{<<"a">> := 1} = json_util:decode(<<"{\"a\":1}">>).

MIT — see LICENSE.

── more in #large-language-models 4 stories · sorted by recency
── more on @erlangchain 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-erlangchain-…] indexed:0 read:1min 2026-07-01 ·