获取单个模型信息
curl --request GET \
--url https://kaienapi.com/v1/models/{model} \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/models/{model}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/models/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/models/{model}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "<string>",
"object": "model",
"created": 123,
"owned_by": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}获取单个模型信息
按模型 ID 查询单个模型对象。
何时调用
- 用户已选定模型,提交前再次确认。
- 后端校验配置中的模型 ID 是否仍然有效。
- 请求返回模型不存在时,判断是模型名写错还是当前 Key 暂不可访问。
请求格式
把 GET /v1/models 返回的 id 放到路径参数 {model}。模型 ID 区分大小写,包含日期、版本号或提供方前缀时需要完整传入。
读取结果
成功时返回一个 model 对象。找不到模型时返回 404,客户端应提示用户重新选择模型,不要继续重试同一个 ID。
GET
/
v1
/
models
/
{model}
获取单个模型信息
curl --request GET \
--url https://kaienapi.com/v1/models/{model} \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1/models/{model}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://kaienapi.com/v1/models/{model}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/v1/models/{model}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "<string>",
"object": "model",
"created": 123,
"owned_by": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}