Raxol.Agent.Backend.HTTP (Raxol Agent v2.6.0)

Copy Markdown View Source

HTTP-based AI backend using Req.

Supports Claude (Anthropic), GPT (OpenAI-compatible), Ollama, and Kimi APIs. The provider is auto-detected from the base URL or can be set explicitly.

Configuration

opts = [
  api_key: "sk-...",
  base_url: "https://api.anthropic.com",
  model: "claude-sonnet-4-20250514",
  provider: :anthropic,  # or :openai, :ollama, :kimi (auto-detected if omitted)
  timeout: 30_000
]

Req Plugins

Pass :req_plugins to attach Req response steps (e.g., auto-pay for HTTP 402):

opts = [
  api_key: "sk-...",
  req_plugins: [
    fn req -> Raxol.Payments.Req.AutoPay.attach(req, wallet: MyWallet) end
  ]
]

Each plugin is a function (Req.Request.t() -> Req.Request.t()) applied before the request is sent. This keeps Backend.HTTP agnostic to payment details while letting callers wire in transparent 402 handling.