curl -X GET "https://t.ato2.nodesms.com/v1/models" \
-H "Authorization: Bearer $API_KEY"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
models = client.models.list()
print(models)
{
"object": "list",
"data": [
{
"id": "string",
"object": "model",
"created": 0,
"owned_by": "string"
}
]
}
{
"error": {
"message": "string",
"type": "string",
"param": null,
"code": null
}
}
模型列表
获取当前可用的模型列表。原生 OpenAI 格式。
GET
/
v1
/
models
curl -X GET "https://t.ato2.nodesms.com/v1/models" \
-H "Authorization: Bearer $API_KEY"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
models = client.models.list()
print(models)
{
"object": "list",
"data": [
{
"id": "string",
"object": "model",
"created": 0,
"owned_by": "string"
}
]
}
{
"error": {
"message": "string",
"type": "string",
"param": null,
"code": null
}
}
根据请求头自动识别返回格式:
- 包含
x-api-key和anthropic-version头时返回 Anthropic 格式 - 包含
x-goog-api-key头或key查询参数时返回 Gemini 格式 - 其他情况返回 OpenAI 格式
请求头
string
必填
使用 Bearer Token 认证。格式:
Authorization: Bearer sk-xxxxxxstring
Anthropic API Key(用于 Claude 格式)
string
Anthropic API 版本
string
Google API Key(用于 Gemini 格式)
查询参数
string
Google API Key(用于 Gemini 格式)
响应
200 成功获取模型列表
格式:application/json
string
对象类型
401 认证失败
格式:application/json
curl -X GET "https://t.ato2.nodesms.com/v1/models" \
-H "Authorization: Bearer $API_KEY"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
models = client.models.list()
print(models)
{
"object": "list",
"data": [
{
"id": "string",
"object": "model",
"created": 0,
"owned_by": "string"
}
]
}
{
"error": {
"message": "string",
"type": "string",
"param": null,
"code": null
}
}
最后修改于 2026年10月28日
此页面对您有帮助吗?