azmaveth

azmaveth

ExLLM - Multi-provider LLM library (inspired by Python’s LiteLLM)

ExLLM - Multi-provider LLM library (inspired by Python’s LiteLLM)

I started this a couple weeks ago using Claude Code. I am a relatively experienced developer, but a newbie with Elixir and unfamiliar with standard conventions. This has not been fully reviewed line-by-line, but it’s in a mostly usable state so I thought I’d share it.

I have used this alongside my other new library - ExMCP (yeah, I’m terrible at naming) to build out a chat client similar to Block’s Goose. It’s been tested fairly extensively with Anthropic, OpenAI, and Ollama, but less with the others.

Feature List:

  • Unified API: Single interface for multiple LLM providers
  • Streaming Support: Real-time streaming responses with error recovery
  • Cost Tracking: Automatic cost calculation for all API calls (if cost data is available)
  • Token Estimation: Heuristic-based token counting for cost prediction
  • Context Management: Automatic message truncation to fit model context windows
  • Session Management: Built-in conversation state tracking and persistence
  • Structured Outputs: Schema validation and retries via Instructor integration
  • Function Calling: Unified interface for tool use across providers
  • Model Discovery: Query and compare model capabilities across providers
  • Capability Normalization: Automatic normalization of provider-specific feature names
  • Error Recovery: Automatic retry with exponential backoff and stream resumption
  • Mock Testing: Built-in mock adapter for testing without API calls (use with Response Caching)
  • Response Caching: Cache real provider responses for offline testing and cost reduction
  • Type Safety: Comprehensive typespecs and structured data
  • Configurable: Flexible configuration system with multiple providers
  • Extensible: Easy to add new LLM providers via adapter pattern

Currently supported providers:

  • Anthropic
  • OpenAI
  • Gemini
  • OpenRouter
  • Groq
  • xAI/Grok

Local providers:

  • Ollama
  • LM Studio
  • Bumblebee

Please give feedback!

https://github.com/azmaveth/ex_llm

Most Liked

gtcode

gtcode

This is great, because DSPy uses LiteLLM. Will switch out to using this lib for the LM adapter in DSPEx.

The Gemini integration looks comprehensive:

https://github.com/azmaveth/ex_llm/tree/master/test/ex_llm/adapters/gemini

Where Next?

Popular in Announcing Top

tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
pkrawat1
Presenting Aviacommerce, open source e-commerce platform in Elixir Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10167 134
New
alisinabh
Hey everyone i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 12560 134
New
michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets · GitHub Ets table ...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New

We're in Beta

About us Mission Statement