reapi

OpenAI-compatible Ruby SDK for the reAPI gateway.

reAPI speaks the OpenAI API. This gem is a thin client over https://api.reapi.ai/v1, using only the Ruby standard library (no dependencies).

Install

gem install reapi

Quick start

require "reapi"

# Reads ENV["REAPI_API_KEY"], or pass api_key:
client = Reapi.client

# Discover available models at runtime:
models = client.models

res = client.chat_completions(
  model: models["data"].first["id"],
  messages: [{ role: "user", content: "Hello from reAPI" }],
)
puts res.dig("choices", 0, "message", "content")

API key

Get an API key at reapi.ai:

client = Reapi.client(api_key: "YOUR_KEY")
export REAPI_API_KEY=YOUR_KEY

License

MIT