class Ollama < OpenAI

Inherits from
OpenAI: #call, #close

Proxies Ollama's OpenAI-compatible HTTP API.

Definitions

def initialize(endpoint: DEFAULT_ENDPOINT, api_key: "ollama", **options)

Initialize a provider with Ollama's local endpoint and API-key default.

Signature

option :endpoint String | Async::HTTP::Endpoint

The Ollama HTTP endpoint.

option :api_key String | Nil

The optional bearer token.

Implementation

def initialize(endpoint: DEFAULT_ENDPOINT, api_key: "ollama", **options)
	super(endpoint: endpoint, api_key: api_key, **options)
end

def models

Fetch Ollama's model list and add supported thinking metadata.

Signature

returns Protocol::HTTP::Response

The enriched OpenAI-compatible model list.

Implementation

def models
	response = super
	return response unless response.status >= 200 && response.status < 300
	
	enrich_models(response)
end