class

Autobot::Providers::HttpProvider

Inherits Autobot::Providers::Provider < Reference < Object

HTTP-based LLM provider supporting OpenAI-compatible chat completion APIs.

Works with: OpenAI, DeepSeek, Groq, Moonshot, MiniMax, OpenRouter, AiHubMix, vLLM, and any OpenAI-compatible endpoint.

For Anthropic, uses the Messages API with automatic format conversion.

Constants

ANTHROPIC_API_VERSION = "2023-06-01"
CONNECT_TIMEOUT = 30.seconds
INITIAL_RETRY_DELAY = 2.seconds
Log = ::Log.for(self)
MAX_RETRIES = 3
RATE_LIMIT_STATUS = 429
READ_TIMEOUT = 300.seconds
SERVER_ERROR_MAX = 599
SERVER_ERROR_MIN = 500
USER_AGENT = "Autobot/#{VERSION}"

Constructors

new(api_key : String, api_base : String | Nil = nil, model : String = "anthropic/claude-sonnet-4-5-20250929", extra_headers : Hash(String, String) = {} of String => String, provider_name : String | Nil = nil)
Source

Instance methods

chat(messages : Array(Hash(String, JSON::Any)), tools : Array(Hash(String, JSON::Any)) | Nil = nil, model : String | Nil = nil, max_tokens : Int32 = DEFAULT_MAX_TOKENS, temperature : Float64 = DEFAULT_TEMPERATURE) : Response
Source
default_model

The default model identifier for this provider.

Source
extra_headers
Source
model
Source