sonic182
Llm_composer - Elixir library for building LLM-based applications
Hi everyone, at Doofinder we have been building llm_composer for some new apps, and we thought it could be useful to share it with the community.
llm_composer is an Elixir library that simplifies working with large language models (LLMs) like OpenAI’s GPT, OpenRouter, Ollama, AWS Bedrock, and Google (Gemini).
It provides a streamlined way to build and execute LLM-based applications or chatbots, with features such as:
- Multi-provider support (OpenAI, OpenRouter, Ollama, Bedrock, Google Gemini/Vertex AI).
- System prompts and message history management.
- Streaming responses.
- Function calls with auto-execution.
- Structured outputs with JSON schema validation.
- Built-in cost tracking (currently for OpenRouter).
- Easy extensibility for custom use cases.
A key feature is the provider router that handles failover automatically.
It will use one provider until it fails, then fall back to the next provider in the list, applying an exponential backoff strategy. This makes it resilient in production environments where provider APIs can become temporarily unavailable.
Under the hood, llm_composer uses Tesla as the HTTP client.
For production setups, especially when using streaming, it is recommended to run it with Finch for optimal performance.
More info and docs:
HexDocs: LlmComposer — llm_composer v0.20.0
GitHub:
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










First Post!
mercyf
This looks great
Most Liked
sonic182
llm_composer v0.16.0 released (Feb 23, 2026)
Quick update since the last post (v0.12.2 / MIT switch) — quite a bit has landed since then.
What’s new in 0.16.0
LlmComposer.Providers.OpenAIResponses— calls OpenAI’s/responsesAPI with support for structured outputs and reasoning (provider/model-specific params passed viarequest_params), normalized into the usualLlmResponseshape. Since it targets the/responsesAPI spec, it also works with compatible providers like x.ai (xAI/Grok), OpenRouter’s responses endpoint, and others.LlmComposer.StreamChunkstruct + provider-specific parsing turns raw stream events into typed values (:text_delta,:tool_call_delta,:done, …).LlmComposer.FunctionCallExtractors: centralizes function call extraction logic per provider.parse_stream_response: now comes in/2and/3arities and returns%StreamChunk{}values instead of raw decoded maps.LlmComposer.ProviderResponse+LlmComposer.ProviderStreamChunk) for cleaner normalization across providers.Notable releases since 0.12.2
FunctionExecutor+FunctionCallHelpers— breaking change, see changelog.request_params(e.g. Google’sgenerationConfig).LlmResponse.new/3now returns{:error, …}instead of raising on unknown provider formats.:json_engine(defaults toJSON, falls back toJason); Google provider now preservesadditionalPropertiesin response schemas.Upgrade
Full changelog: llm_composer/CHANGELOG.md at master · doofinder/llm_composer · GitHub
Jskalc
Thanks for your efforts!
Could you highlight the differences from ReqLLM, discussed in this topic? I believe both libraries aim to solve the same problem.
sonic182
We started this lib about a year ago (we’d been using it internally even before that) and only now decided to share it here.
Both libraries aim at the same thing: wrapping LLM APIs behind a unified HTTP client.
The main differences are:
HTTP layer: we use Tesla, ReqLLM builds on Req.
Routing: llm_composer includes a router with fallback + retries.
API style: each library exposes a slightly different way to configure and work with “bots” or requests, so it depends which style you prefer.
Last Post!
sonic182
Hi all! Just released v0.20.0 — the headline is a new
LlmComposer.Agentmodule.LlmComposer.Agent— automatic tool-calling loopHandles the full ask → execute → repeat cycle so you don’t have to manage it manually. Supports sequential and parallel tool execution, a configurable iteration limit, and per-tool error recovery.
Streaming agent (
stream_response: true)The agent now supports streaming, returning a lazy stream of
StreamChunks::text_delta— model text as it arrives:tool_call— emitted after each tool execution, result included (no extra telemetry handler needed):done— terminal chunk with cumulative usage and the fullAgent.ResultWorks across all supported providers:
:open_ai,:open_router,:open_ai_responses,:google,:bedrock,:ollama.Telemetry improvements
Spans for
run_completionandproviders_runner, enriched agent events with per-tool arguments and reasoning deltas, plus a:telemetry_metadataoption to scope handlers to a single run.Full changelog: Comparing 0.19.6...0.20.0 · doofinder/llm_composer · GitHub