获取 Gemini OpenAI 兼容模型列表
curl --request GET \
--url https://kaienapi.com/v1beta/openai/models \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1beta/openai/models"
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/v1beta/openai/models', 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/v1beta/openai/models"
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))
}{
"object": "list",
"data": [
{
"id": "<string>",
"object": "model",
"created": 123,
"owned_by": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}获取 Gemini OpenAI 兼容模型列表
获取 Gemini OpenAI 兼容入口可用的模型列表。
何时调用
- 客户端按 OpenAI 模型列表格式读取模型。
- 把 Gemini 模型接入 OpenAI 兼容 SDK。
- 同一个前端模型选择器需要使用
object: list结构。
读取结果
响应使用 OpenAI 模型列表结构,模型 ID 可继续用于 OpenAI 兼容请求。若使用 Gemini 原生接口,优先查看 /v1beta/models。
GET
/
v1beta
/
openai
/
models
获取 Gemini OpenAI 兼容模型列表
curl --request GET \
--url https://kaienapi.com/v1beta/openai/models \
--header 'Authorization: Bearer <token>'import requests
url = "https://kaienapi.com/v1beta/openai/models"
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/v1beta/openai/models', 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/v1beta/openai/models"
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))
}{
"object": "list",
"data": [
{
"id": "<string>",
"object": "model",
"created": 123,
"owned_by": "<string>"
}
]
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}