Models

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.

List models

GET https://api.openai.com/v1/models

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Example request:

curl:

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY"

python:

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Model.list()

node.js:

const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.listModels();

Response:

{
  "data": [
    {
      "id": "model-id-0",
      "object": "model",
      "owned_by": "organization-owner",
      "permission": [...]
    },
    {
      "id": "model-id-1",
      "object": "model",
      "owned_by": "organization-owner",
      "permission": [...]
    },
    {
      "id": "model-id-2",
      "object": "model",
      "owned_by": "openai",
      "permission": [...]
    },
  ],
  "object": "list"
}

Retrieve model

GET https://api.openai.com/v1/models/{model}

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

Path parameters

modelstring Required

The ID of the model to use for this request

Request:

curl:

curl https://api.openai.com/v1/models/{model} \
  -H "Authorization: Bearer $OPENAI_API_KEY"

python:

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Model.retrieve("{model}")

node.js:

const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.retrieveModel("{model}");

Response:

{
  "id": "{model}",
  "object": "model",
  "owned_by": "openai",
  "permission": [...]
}

Supported models:

  • babbage
  • davinci
  • text-davinci-001
  • ada
  • text-curie-001
  • text-davinci-003
  • curie-instruct-beta
  • davinci-instruct-beta
  • text-babbage-001
  • curie
  • text-davinci-002
An Example for babbage

Example request:

curl:

curl https://api.openai.com/v1/models/babbage \
  -H "Authorization: Bearer $OPENAI_API_KEY"

python:

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Model.retrieve("babbage")

node.js:

const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.retrieveModel("babbage");

Response:

{
  "id": "babbage",
  "object": "model",
  "owned_by": "openai",
  "permission": [...]
}