Functions

get-model

fn (p: ::openai::compatible/CompatibleProvider, model: Str): Map
fn (p: ::openai::compatible/CompatibleProvider, model: Str, opts: Map): Map

GET /models/{model}: one model's metadata, or an Err carrying HttpError. Not every provider implements it.

Example

p ::openai-compatible/openrouter()
model ::openai-compatible::models/get-model(p, "openrouter/openai/gpt-5.2")
model.id

list-models

fn (p: ::openai::compatible/CompatibleProvider): Map
fn (p: ::openai::compatible/CompatibleProvider, opts: Map): Map

GET /models: the models the provider exposes, as the decoded body ({data: [{id, ...}]}), or an Err carrying HttpError.

Example

page ::openai-compatible::models/list-models(::openai-compatible/ollama())
map(page.data, (m) { m.id })

model-path

fn (p: ::openai::compatible/CompatibleProvider, model: Str): Str

The /models/{id} path with the routing prefix stripped and the id URL-encoded (OpenRouter-style ids contain /).

Example

p ::openai-compatible/configure(::openai-compatible/OPENROUTER, "k")
::openai-compatible::models/model-path(p, "openrouter/openai/gpt-5.2")  // => "/models/openai%2Fgpt-5.2"