ProviderModelListers

org.llm4s.config.ProviderModelListers
@Stable

The factory behind the model listers of providers serving the OpenAI /models shape.

llm4s-core holds only the ProviderModelLister contract. This factory lived there too until it was found to read a vendor field - OpenAI's organization - straight off NamedProviderConfig; it moved here, with the OpenAI wire format, when that field became a provider-specific key (#1133). Its package is unchanged. A provider module that serves the same shape depends on llm4s-openai-compatible and calls openAICompatible; one that does not implements ProviderModelLister.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def openAICompatible(provider: ProviderId, defaultBaseUrl: String, modelsPath: String, extraHeaders: Map[String, String], apiKeyRequired: Boolean, sectionHeaders: NamedProviderConfig => Map[String, String]): ProviderModelLister

A lister for any provider serving the OpenAI-compatible /models endpoint.

A lister for any provider serving the OpenAI-compatible /models endpoint.

Every request carries Authorization: Bearer <apiKey> when the section has a key, then sectionHeaders(section), then extraHeaders, then the section's own headers; a later header of the same name wins.

Value parameters

apiKeyRequired

whether a section without an apiKey fails; false for endpoints, such as a local server, that take unauthenticated requests

defaultBaseUrl

base URL used when the section does not override it

extraHeaders

headers the provider requires on every request, e.g. OpenRouter's X-Title

modelsPath

path of the listing endpoint, relative to the base URL

provider

the ProviderId that owns the returned models; the config section must name it

sectionHeaders

headers derived from the section being listed - typically from a provider-specific key, as openAIOrganizationHeader sends OpenAI's organization. None by default.

Attributes

Concrete fields

val openAIOrganizationHeader: NamedProviderConfig => Map[String, String]

The section's organization key, as the OpenAI-Organization header - for a provider that declares org.llm4s.llmconnect.config.OpenAIConfig.OrganizationKey, passed as sectionHeaders. Empty when the section sets none.

The section's organization key, as the OpenAI-Organization header - for a provider that declares org.llm4s.llmconnect.config.OpenAIConfig.OrganizationKey, passed as sectionHeaders. Empty when the section sets none.

Attributes