引擎
获取API支持的各种引擎的信息
此接口已被废弃,请改用它们的替代品——模型。了解更多。
获取引擎列表
GET https://api.openai.com/v1/engines
列出当前可用(非优化)的模型,并提供每个模型的基本信息,例如所有者和可用性。
请求示例
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"
}
获取引擎详细信息
GET https://api.openai.com/v1/engines/{engine_id}
检索模型实例,提供基本信息,例如所有者和可用性。
路径参数
engine_id 字符串 必填项 此请求使用的引擎的ID
请求示例
curl https://api.openai.com/v1/engines/text-davinci-003 \
-H "Authorization: Bearer $OPENAI_API_KEY"
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Engine.retrieve("text-davinci-003")
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("text-davinci-003");
返回结果
{
"id": "text-davinci-003",
"object": "engine",
"owner": "openai",
"ready": true
}
最后更新于