大家好,我是淘小白~
最近在测试chatgpt api接口的时候,用到了3.5和4.0的apikey,因为模型要自定义,所以,就需要对两个类型的apikey 进行测试,在测试时候,3.5的apikey 还好,但是很多4.0的apikey ,很多问题没有遇到过,比如,查看4.0apikey 能够调用哪些模型,不同组织给的4.0apikey 好像还有一些差异,在测试的过程中,使用Python查看自己的apikey , 能调用哪些模型,让我们来看下Python方法。
1、安装openai库
pip install openai
安装库如果让你升级,就升级一下,现在好像是28的版本,我记得之前升级是27版本。
2、检查能调用哪些模型示例代码
openai.api_key = 'sk-********************'
# 上面的apikey 换成自己的
models=openai.Model.list()
print(models)
这样就可以查看哪些模型可以调用了。
3、得到的返回结果
{
"object": "list",
"data": [
{
"id": "text-search-babbage-doc-001",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "gpt-3.5-turbo-16k",
"object": "model",
"created": 1683758102,
"owned_by": "openai-internal"
},
{
"id": "curie-search-query",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "text-davinci-003",
"object": "model",
"created": 1669599635,
"owned_by": "openai-internal"
},
{
"id": "text-search-babbage-query-001",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "babbage",
"object": "model",
"created": 1649358449,
"owned_by": "openai"
},
{
"id": "babbage-search-query",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "text-babbage-001",
"object": "model",
"created": 1649364043,
"owned_by": "openai"
},
{
"id": "text-similarity-davinci-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "davinci-similarity",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "code-davinci-edit-001",
"object": "model",
"created": 1649880484,
"owned_by": "openai"
},
{
"id": "curie-similarity",
"object": "model",
"created": 1651172510,
"owned_by": "openai-dev"
},
{
"id": "babbage-search-document",
"object": "model",
"created": 1651172510,
"owned_by": "openai-dev"
},
{
"id": "curie-instruct-beta",
"object": "model",
"created": 1649364042,
"owned_by": "openai"
},
{
"id": "text-search-ada-doc-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "davinci-instruct-beta",
"object": "model",
"created": 1649364042,
"owned_by": "openai"
},
{
"id": "gpt-3.5-turbo-instruct",
"object": "model",
"created": 1692901427,
"owned_by": "system"
},
{
"id": "text-similarity-babbage-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "text-search-davinci-doc-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "gpt-3.5-turbo-instruct-0914",
"object": "model",
"created": 1694122472,
"owned_by": "system"
},
{
"id": "babbage-similarity",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "text-embedding-ada-002",
"object": "model",
"created": 1671217299,
"owned_by": "openai-internal"
},
{
"id": "davinci-search-query",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "text-similarity-curie-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "text-davinci-001",
"object": "model",
"created": 1649364042,
"owned_by": "openai"
},
{
"id": "text-search-davinci-query-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "ada-search-document",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "ada-code-search-code",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "babbage-002",
"object": "model",
"created": 1692634615,
"owned_by": "system"
},
{
"id": "davinci-002",
"object": "model",
"created": 1692634301,
"owned_by": "system"
},
{
"id": "davinci-search-document",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "curie-search-document",
"object": "model",
"created": 1651172508,
"owned_by": "openai-dev"
},
{
"id": "babbage-code-search-code",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "text-search-ada-query-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "code-search-ada-text-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "gpt-3.5-turbo-16k-0613",
"object": "model",
"created": 1685474247,
"owned_by": "openai"
},
{
"id": "babbage-code-search-text",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "code-search-babbage-code-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "ada-search-query",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "ada-code-search-text",
"object": "model",
"created": 1651172510,
"owned_by": "openai-dev"
},
{
"id": "tts-1-hd",
"object": "model",
"created": 1699046015,
"owned_by": "system"
},
{
"id": "text-search-curie-query-001",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "text-davinci-002",
"object": "model",
"created": 1649880484,
"owned_by": "openai"
},
{
"id": "text-davinci-edit-001",
"object": "model",
"created": 1649809179,
"owned_by": "openai"
},
{
"id": "code-search-babbage-text-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "tts-1-hd-1106",
"object": "model",
"created": 1699053533,
"owned_by": "system"
},
{
"id": "ada",
"object": "model",
"created": 1649357491,
"owned_by": "openai"
},
{
"id": "text-ada-001",
"object": "model",
"created": 1649364042,
"owned_by": "openai"
},
{
"id": "ada-similarity",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "code-search-ada-code-001",
"object": "model",
"created": 1651172507,
"owned_by": "openai-dev"
},
{
"id": "text-similarity-ada-001",
"object": "model",
"created": 1651172505,
"owned_by": "openai-dev"
},
{
"id": "canary-whisper",
"object": "model",
"created": 1699656801,
"owned_by": "system"
},
{
"id": "whisper-1",
"object": "model",
"created": 1677532384,
"owned_by": "openai-internal"
},
{
"id": "text-search-curie-doc-001",
"object": "model",
"created": 1651172509,
"owned_by": "openai-dev"
},
{
"id": "text-curie-001",
"object": "model",
"created": 1649364043,
"owned_by": "openai"
},
{
"id": "curie",
"object": "model",
"created": 1649359874,
"owned_by": "openai"
},
{
"id": "canary-tts",
"object": "model",
"created": 1699492935,
"owned_by": "system"
},
{
"id": "tts-1",
"object": "model",
"created": 1681940951,
"owned_by": "openai-internal"
},
{
"id": "gpt-3.5-turbo-1106",
"object": "model",
"created": 1698959748,
"owned_by": "system"
},
{
"id": "gpt-3.5-turbo-0613",
"object": "model",
"created": 1686587434,
"owned_by": "openai"
},
{
"id": "gpt-3.5-turbo-0301",
"object": "model",
"created": 1677649963,
"owned_by": "openai"
},
{
"id": "gpt-3.5-turbo",
"object": "model",
"created": 1677610602,
"owned_by": "openai"
},
{
"id": "davinci",
"object": "model",
"created": 1649359874,
"owned_by": "openai"
},
{
"id": "dall-e-2",
"object": "model",
"created": 1698798177,
"owned_by": "system"
},
{
"id": "tts-1-1106",
"object": "model",
"created": 1699053241,
"owned_by": "system"
}
]
}
其中里面的id 就是该apikey 可以调用的模型