OpenAI Models API - List and retrieve available models.

Functions

get

fn (model_id: Str): Model
fn (model_id: Str, opts: Map): Model

GET /models/{model_id} - Retrieve a specific model by its ID.

Returns a Model with id, object, created, and owned_by fields.

Example

model ::openai::models/get("gpt-4o")
model.id       // => "gpt-4o"
model.owned_by // => "system"
model.created  // => 1715367049

list

fn (): ModelsListResponse
fn (opts: Map): ModelsListResponse

GET /models - List all available models.

Returns a ModelsListResponse with a data field containing a Vec of Model objects.

Example

models ::openai::models/list()
first-model first(models.data)
first-model.id       // => "gpt-4o-mini"
first-model.owned_by // => "system"

Types

Model

Model type {
    id: Str,
    object: Str,
    created: Int,
    owned_by: Str
}

ModelsListResponse

ModelsListResponse type {
    object: Str,
    data: Vec<Model>
}