List Models (OpenAI Format)
Get a list of currently available models.
The return format is automatically identified based on the request headers:
- Returns Anthropic format when
x-api-keyandanthropic-versionheaders are included - Returns Gemini format when
x-goog-api-keyheader orkeyquery parameter is included - Returns OpenAI format in other cases
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Query Parameters
key?string
Google API Key (用于 Gemini 格式)
Header Parameters
x-api-key?string
Anthropic API Key (用于 Claude 格式)
anthropic-version?string
Anthropic API 版本
x-goog-api-key?string
Google API Key (用于 Gemini 格式)
Response Body
application/json
application/json
curl -X GET "https://docs.newapi.ai/v1/models"{
"object": "list",
"data": [
{
"id": "gpt-4",
"object": "model",
"created": 0,
"owned_by": "openai"
}
]
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}How is this guide?
Last updated on