{"slug": "show-hn-erlangchain-a-tiny-erlang-client-for-llms", "title": "Show HN: Erlangchain – A tiny Erlang client for LLMs", "summary": "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.", "body_md": "Minimal building blocks for talking to LLMs from Erlang, with zero third-party\ndependencies (only OTP `inets`\n\n+ `ssl`\n\n).\n\n| Module | Role |\n|---|---|\n`llm` |\none-call chat client for OpenAI (Responses API) and Anthropic, with tool-use and multimodal support |\n`json_util` |\ndependency-free JSON encode/decode |\n\n```\n%% rebar.config\n{deps, [\n    {erlangchain, {git, \"https://github.com/abhavk/erlangchain.git\", {tag, \"0.1.0\"}}}\n]}.\n```\n\nSet `OPENAI_API_KEY`\n\nand/or `ANTHROPIC_API_KEY`\n\nin the environment (a `.env`\n\nfile in the working directory is loaded automatically if present).\n\n```\n%% Simple completion (defaults to openai/small):\n{ok, #{content := Text}} = llm:chat([#{role => user, content => <<\"hello\">>}]),\n\n%% Pick provider + size:\n{ok, Resp} = llm:chat(openai, big, Messages),\n\n%% Tool use — pass tool specs, get back tool_calls to run and feed back:\n{ok, #{tool_calls := Calls}} = llm:chat(openai, big, Messages, Tools).\n```\n\n`Messages`\n\nare maps like `#{role => system|user|assistant, content => binary()}`\n\n,\nplus `#{role => tool_result, tool_use_id => Id, content => Bin}`\n\nto return tool\noutput. See the header of `src/llm.erl`\n\nfor the full message/response shapes.\n\n``` js\n<<\"{\\\"a\\\":1}\">> = json_util:encode(#{<<\"a\">> => 1}),\n#{<<\"a\">> := 1} = json_util:decode(<<\"{\\\"a\\\":1}\">>).\n```\n\nMIT — see [LICENSE](/abhavk/erlangchain/blob/main/LICENSE).", "url": "https://wpnews.pro/news/show-hn-erlangchain-a-tiny-erlang-client-for-llms", "canonical_source": "https://github.com/abhavk/erlangchain", "published_at": "2026-07-01 07:57:24+00:00", "updated_at": "2026-07-01 08:19:59.520770+00:00", "lang": "en", "topics": ["large-language-models", "developer-tools", "ai-tools"], "entities": ["Erlangchain", "abhavk", "OpenAI", "Anthropic", "OTP", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/show-hn-erlangchain-a-tiny-erlang-client-for-llms", "markdown": "https://wpnews.pro/news/show-hn-erlangchain-a-tiny-erlang-client-for-llms.md", "text": "https://wpnews.pro/news/show-hn-erlangchain-a-tiny-erlang-client-for-llms.txt", "jsonld": "https://wpnews.pro/news/show-hn-erlangchain-a-tiny-erlang-client-for-llms.jsonld"}}