OpenAI API Engines

2023-03-21 14:17 更新

引擎端点已弃用。

请改用他们的替代品 Models。

这些端点描述并提供对 API 中可用的各种引擎的访问。


List engines

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

列出当前可用(未微调)的模型,并提供有关每个模型的基本信息,例如所有者和可用性。

示例请求

curl python  node.js 
curl https://api.openai.com/v1/engines \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Engine.list()
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.listEngines();

响应

{
  "data": [
    {
      "id": "engine-id-0",
      "object": "engine",
      "owner": "organization-owner",
      "ready": true
    },
    {
      "id": "engine-id-2",
      "object": "engine",
      "owner": "organization-owner",
      "ready": true
    },
    {
      "id": "engine-id-3",
      "object": "engine",
      "owner": "openai",
      "ready": false
    },
  ],
  "object": "list"
}

Retrieve engine

GET https://api.openai.com/v1/engines/{engine_id}

检索模型实例,提供有关它的基本信息,例如所有者和可用性。

Path parameters

字段 类型  是否可选  说明 
engine_id
string
必选

用于此请求的引擎的 ID

示例请求

curl python  node.js 
curl https://api.openai.com/v1/engines/ada \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Engine.retrieve("ada")
const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.retrieveEngine("ada");

响应

{
  "id": "ada",
  "object": "engine",
  "owner": "openai",
  "ready": true
}


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号