ReqAI is an extensible Elixir client for AI APIs, built on Req.
{:ok, %Req.Response{}, %{"output" => [%{"content" => [content]}]}} =
ReqAI.generate(ReqAI.Provider.OpenAI,
model: "gpt-5.4-mini",
input: "Say hello"
)
IO.puts(content["text"])See the Getting Started guide for configuration and usage examples.
Features
- Generate and stream with one calling convention, using each provider's request and response formats.
- Built-in adapters for Anthropic, OpenAI, Gemini, OpenRouter, and TypeSafe. Add custom adapters with the Provider behaviour.
- Telemetry for request lifecycle, duration, token usage, and time to first chunk. Customize metadata with the Telemetry behaviour.
- Configure authentication, retries, timeouts, and testing through Req.
- Optional translators for your own request, response, error, and event shapes.
Installation
Add ReqAI to your dependencies in mix.exs:
{:req_ai, ">= 0.0.0"}Requires Elixir 1.18 or later and Req 0.8.0 or later.