接口说明
模型查询(Model)
1.功能介绍
列出平台可用的模型列表,并提供相关模型的基本信息。
GET https://api.scnet.cn/api/llm/v1/models
2.请求参数
Header 参数
名称 | 类型 | 必需 | 示例值 |
---|---|---|---|
Content-Type | string | 是 | application/json |
Authorization | string | 是 | Bearer |
3.响应参数
名称 | 类型 | 描述 |
---|---|---|
object | string | 其值为list。 |
data | Model[] | id(string),模型的标识符。object(string),对象的类型,其值为 model。owned_by(string),拥有该模型的组织。 |
4.请求示例
cURL请求示例
curl -L -X GET 'https://api.scnet.cn/api/llm/v1/models' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API Key>'
Python请求示例
- OpenAI SDK
from openai import OpenAI
client = OpenAI(api_key="<API key>", base_url="https://api.scnet.cn/api/llm/v1")
print(client.models.list())
- REQUESTS
import requests
url = "https://api.scnet.cn/api/llm/v1/models"
payload={}
headers = {
"Accept": "application/json",
"Authorization": "Bearer <API Key>"
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
- HTTP.CLIENT
import http.client
conn = http.client.HTTPSConnection("api.scnet.cn")
payload = ""
headers = {
"Accept": "application/json",
"Authorization": "Bearer <API Key>"
}
conn.request("GET", "/api/llm/v1/models", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Go请求示例
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.scnet.cn/api/llm/v1/models"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <API Key>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Nodejs请求示例
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://api.scnet.cn/api/llm/v1",
apiKey: "<API Key>"
});
async function main() {
const models = await openai.models.list()
for await (const model of models) {
console.log(model);
}
}
main();
5.响应示例
{
"object": "list",
"data": [
{
"id": "DeepSeek-R1-Distill-Qwen-7B",
"object": "model",
"owned_by": "deepseek"
}
]
}