GET
List models
返回当前 API Key 有权限访问的模型列表,格式兼容 OpenAI Models API。模型列表由后台控制台绑定配置决定。
Authentication
在请求头中使用 Bearer Token 进行鉴权。支持 Authorization: Bearer、x-api-key、x-goog-api-key 三种格式。
AuthorizationstringRequired格式为 Bearer $HY_API_KEY。
Errors
API 请求失败时可能返回以下 HTTP 状态码:
GET
| 1 | import OpenAI from 'openai' |
| 2 | |
| 3 | const client = new OpenAI({ |
| 4 | apiKey: process.env.HY_API_KEY, |
| 5 | baseURL: 'https://apiclaw.cc/v1', |
| 6 | }) |
| 7 | |
| 8 | const models = await client.models.list() |
| 9 | for (const model of models.data) { |
| 10 | console.log(model.id) |
| 11 | } |
GET
Authorization
获取 API Key →🔑
REQUEST
| 1 | const response = await fetch("https://apiclaw.cc/v1/models", { |
| 2 | method: "GET", |
| 3 | headers: { |
| 4 | "Authorization": "Bearer YOUR_API_KEY", |
| 5 | "Content-Type": "application/json", |
| 6 | }, |
| 7 | }); |
| 8 | const data = await response.json(); |
| 9 | console.log(data); |
RESPONSE
◎
点击 Send request 查看响应
Response
| 1 | { |
| 2 | "object": "list", |
| 3 | "data": [ |
| 4 | { |
| 5 | "id": "claude-sonnet-4-6", |
| 6 | "object": "model", |
| 7 | "created": 1747756800, |
| 8 | "owned_by": "hy-router" |
| 9 | }, |
| 10 | { |
| 11 | "id": "gpt-5.4", |
| 12 | "object": "model", |
| 13 | "created": 1747756800, |
| 14 | "owned_by": "hy-router" |
| 15 | }, |
| 16 | { |
| 17 | "id": "gemini-3.1-pro-preview", |
| 18 | "object": "model", |
| 19 | "created": 1747756800, |
| 20 | "owned_by": "hy-router" |
| 21 | } |
| 22 | ] |
| 23 | } |

