curl --request GET \
--url 'https://toapis.com/v1/models' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'https://toapis.com/v1/models?type=all' \
--header 'Authorization: Bearer <token>'
import requests
API_BASE = 'https://toapis.com'
API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx'
headers = {
'Authorization': f'Bearer {API_KEY}'
}
response = requests.get(f'{API_BASE}/v1/models', headers=headers)
data = response.json()
if data.get('success'):
for model in data.get('data', []):
print(model['id'])
else:
print(data)
const API_BASE = 'https://toapis.com';
const API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx';
async function listModels(type = 'text') {
const url = new URL('/v1/models', API_BASE);
if (type) url.searchParams.set('type', type);
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${API_KEY}`,
},
});
const data = await response.json();
console.log(data.data?.map((model) => model.id));
return data;
}
listModels('all');
{
"success": true,
"object": "list",
"data": [
{
"id": "claude-sonnet-4-6",
"object": "model",
"created": 1626777600,
"owned_by": "anthropic",
"supported_endpoint_types": ["chat_completions", "responses"]
},
{
"id": "gpt-5",
"object": "model",
"created": 1626777600,
"owned_by": "openai",
"supported_endpoint_types": ["chat_completions"]
}
]
}
文本对话系列
列出模型
查询当前 API Key 可用的模型列表,兼容 OpenAI Models API
GET
/
v1
/
models
curl --request GET \
--url 'https://toapis.com/v1/models' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'https://toapis.com/v1/models?type=all' \
--header 'Authorization: Bearer <token>'
import requests
API_BASE = 'https://toapis.com'
API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx'
headers = {
'Authorization': f'Bearer {API_KEY}'
}
response = requests.get(f'{API_BASE}/v1/models', headers=headers)
data = response.json()
if data.get('success'):
for model in data.get('data', []):
print(model['id'])
else:
print(data)
const API_BASE = 'https://toapis.com';
const API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx';
async function listModels(type = 'text') {
const url = new URL('/v1/models', API_BASE);
if (type) url.searchParams.set('type', type);
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${API_KEY}`,
},
});
const data = await response.json();
console.log(data.data?.map((model) => model.id));
return data;
}
listModels('all');
{
"success": true,
"object": "list",
"data": [
{
"id": "claude-sonnet-4-6",
"object": "model",
"created": 1626777600,
"owned_by": "anthropic",
"supported_endpoint_types": ["chat_completions", "responses"]
},
{
"id": "gpt-5",
"object": "model",
"created": 1626777600,
"owned_by": "openai",
"supported_endpoint_types": ["chat_completions"]
}
]
}
- 兼容 OpenAI Models API 格式
- 返回当前 API Key 与用户组可用的模型
- 默认返回文字模型,可通过
type=all获取全部类型模型 - 可按模型类型筛选文字、图片、视频或音频模型
Authorizations
string
必填
所有接口均需要使用 Bearer Token 进行认证获取 API Key:访问 API Key 管理页面 获取您的 API Key使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
Query Parameters
string
默认值:"text"
模型类型筛选。可选值:
text或chat:仅返回文字对话模型image:仅返回图片模型video:仅返回视频模型audio:仅返回音频模型all:返回全部可用模型
Response
boolean
请求是否成功。
string
列表对象类型,固定为
list。object[]
curl --request GET \
--url 'https://toapis.com/v1/models' \
--header 'Authorization: Bearer <token>'
curl --request GET \
--url 'https://toapis.com/v1/models?type=all' \
--header 'Authorization: Bearer <token>'
import requests
API_BASE = 'https://toapis.com'
API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx'
headers = {
'Authorization': f'Bearer {API_KEY}'
}
response = requests.get(f'{API_BASE}/v1/models', headers=headers)
data = response.json()
if data.get('success'):
for model in data.get('data', []):
print(model['id'])
else:
print(data)
const API_BASE = 'https://toapis.com';
const API_KEY = 'sk-xxxxxxxxxxxxxxxxxxxxxx';
async function listModels(type = 'text') {
const url = new URL('/v1/models', API_BASE);
if (type) url.searchParams.set('type', type);
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${API_KEY}`,
},
});
const data = await response.json();
console.log(data.data?.map((model) => model.id));
return data;
}
listModels('all');
{
"success": true,
"object": "list",
"data": [
{
"id": "claude-sonnet-4-6",
"object": "model",
"created": 1626777600,
"owned_by": "anthropic",
"supported_endpoint_types": ["chat_completions", "responses"]
},
{
"id": "gpt-5",
"object": "model",
"created": 1626777600,
"owned_by": "openai",
"supported_endpoint_types": ["chat_completions"]
}
]
}
说明
- 如果 API Key 配置了模型限制,只会返回该令牌允许访问的模型。
- 如果不传
type,视频和音频等异步任务模型不会出现在默认结果中。 - 如果需要获取图片、视频、音频等全部可用模型,请使用
GET /v1/models?type=all。
⌘I