Skip to main content

openai.openai.listmodels

Home > @runlightyear/openai > OpenAI > listModels

OpenAI.listModels() method

List and describe the various models available in the API. You can refer to the Models documentation to understand what models are available and the differences between them.

Signature:
listModels(): Promise<ListModelsResponse>;
Returns:

Promise<ListModelsResponse>

Example

List models

const result = await openai.listModels();
const models = result.data.data;
console.log("Model ids: ", models.map((model) => model.id).join(", "));