获取令牌支持模型
curl --request GET \
--url https://api.example.com/v1/modelsimport requests
url = "https://api.example.com/v1/models"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/models"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/models")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyAPI Key & 控制台管理
获取令牌支持模型
查询指定令牌可使用的模型列表
GET
/
v1
/
models
获取令牌支持模型
curl --request GET \
--url https://api.example.com/v1/modelsimport requests
url = "https://api.example.com/v1/models"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v1/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/models"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/models")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body更新日期:2026-06-06
接口说明
获取当前令牌(API Key)可以调用的模型列表。如果令牌未限制模型,则返回系统所有已启用模型。 当前推荐并实际支持的接口是:GET /v1/models
GET /api/token/models 不是当前公开可用的接口,请使用 /v1/models。
认证方式
使用 API Key(sk-xxx)进行认证:Authorization: Bearer sk-xxx
响应格式
{
"success": true,
"object": "list",
"data": [
{
"id": "gpt-5.5",
"object": "model",
"owned_by": "openai"
},
{
"id": "claude-opus-4-8",
"object": "model",
"owned_by": "anthropic"
}
]
}
代码示例
from openai import OpenAI
client = OpenAI(
api_key="sk-xxx",
base_url="https://api.crazyrouter.com/v1"
)
# 通过 OpenAI SDK 获取模型列表
models = client.models.list()
for model in models.data:
print(model.id)
import requests
response = requests.get(
"https://api.crazyrouter.com/v1/models",
headers={"Authorization": "Bearer sk-xxx"}
)
models = response.json()["data"]
for model in models:
print(model["id"])
curl https://api.crazyrouter.com/v1/models \
-H "Authorization: Bearer sk-xxx"
如果你使用 OpenAI SDK,
client.models.list() 实际就是在调用 GET /v1/models。⌘I