Hex.pm Documentation CI License

Elixir SDK for Bifrost, the LLM gateway by Maxim

Installation

Add ex_bifrost to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_bifrost, "~> 0.1.0"}
  ]
end

Configuration

# config/runtime.exs
config :ex_bifrost,
  base_url: System.get_env("API_BASE_URL", "http://localhost:8080")

Usage

# Create a connection to your Bifrost gateway
conn = ExBifrost.Connection.new(base_url: "http://localhost:8080")

# Send a chat completion through the gateway — responses decode into
# typed model structs
request = %ExBifrost.Model.ChatCompletionRequest{
  model: "openai/gpt-4o-mini",
  messages: [%{role: "user", content: "Hello from Elixir!"}]
}

{:ok, %ExBifrost.Model.ChatCompletionResponse{choices: choices}} =
  ExBifrost.Api.ChatCompletions.create_chat_completion(conn, request)

# Other gateway features are available under ExBifrost.Api.*, e.g.
# Providers, Models, Embeddings, Files, Governance, and MCP
{:ok, models} = ExBifrost.Api.Models.list_models(conn)

Development

./scripts/regenerate.sh   # regenerate from openapi-spec.yaml
mix check                 # full quality gate (mirrors CI)
mix dialyzer              # type check

Documentation

License

See LICENSE for details.


Generated with ❤️ using the Elixir SDK Generator template