api-model-query
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "api-model-query" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-431a8a50e26191c708a19b30cb4f2b9bc8b48b87bc75579092b75cae1b2e44c1. Verify the upstream source and version against https://skillhub.cn/skills/user_b22a52ba/api-model-query before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
API Model Query — Query the list of available models based on an API endpoint address.
Introduction source: third_party · user_b22a52ba · 2.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: api-model-query
description: 根据 API 端点地址查询可用模型列表。触发关键词:当用户提供 API 端点地址(如 https://api.openai.com/v1)并询问"这个地址能用哪些模型""有哪些模型可用""查询可用模型""看看这个
API 支持什么模型""这个 endpoint 有哪些模型""这个中转站有哪些模型""查一下这个 API 的模型列表"时使用。也适用于用户给出 API 中转站地址、模型聚合平台地址、自部署
API 地址等需要查询模型列表的场景。
version: 2.0.0
tags:
- api
slug: api-model-query
displayName: Api Model Query
summary: 根据 API 端点地址查询可用模型列表API 模型查询
概述
根据用户提供的 API 端点地址,自动查询该地址下可用的模型列表。支持 OpenAI 兼容格式的 API,自动识别提供商,支持认证和非认证端点。
核心能力
- 多路径探测:自动尝试
/v1/models、/models等常见路径 - 提供商识别:基于 URL 和模型名称自动识别 API 提供商(OpenAI、DeepSeek、Anthropic、Google、智谱、月之暗面、百川、阶跃星辰、零一万物、硅基流动等 30+ 家)
- 认证支持:支持通过
--api-key传入 Bearer Token - 多输出格式:支持可读文本和 JSON 格式输出
- 结果保存:支持将查询结果保存到文件
使用方法
基本用法
python scripts/query_models.py <endpoint_url>
常用示例
查询 OpenAI 模型:
python scripts/query_models.py https://api.openai.com/v1
查询 DeepSeek 模型(需 API Key):
python scripts/query_models.py https://api.deepseek.com/v1 --api-key sk-your-key-here
查询需要认证的端点:
python scripts/query_models.py https://api.xxx.com/v1 --api-key sk-xxx
以 JSON 格式输出:
python scripts/query_models.py https://api.openai.com/v1 --json
保存结果到文件:
python scripts/query_models.py https://api.openai.com/v1 --output models.txt
设置超时时间(秒):
python scripts/query_models.py https://api.slow.com/v1 --timeout 30
参数说明
| 参数 | 简写 | 说明 | 默认值 |
|---|---|---|---|
endpoint |
(必填) | API 端点地址 | - |
--api-key |
-k |
API Key (Bearer Token) | 无 |
--timeout |
-t |
请求超时秒数 | 15 |
--json |
-j |
以 JSON 格式输出 | 否 |
--output |
-o |
保存结果到文件 | 无 |
支持的 API 格式
脚本自动尝试以下路径(按优先级):
{endpoint}/models(如https://api.openai.com/v1/models){endpoint}/v1/models(如https://api.openai.com/models)
如果 endpoint 以 /v1 结尾,还会尝试去掉 /v1 后的路径。
响应格式说明
成功响应(可读文本)
============================================================
API 模型查询结果
============================================================
状态: 成功
端点: https://api.openai.com/v1/models
提供商: OpenAI
模型数量: 3
------------------------------------------------------------
可用模型列表:
1. gpt-4o
2. gpt-4o-mini
3. gpt-4-turbo
============================================================
需要认证的响应
============================================================
API 模型查询结果
============================================================
状态: 失败
端点: https://api.deepseek.com/v1/models
错误: 需要认证 (HTTP 401)
详情: ...
------------------------------------------------------------
[提示] 该端点需要 API Key 认证,请使用 --api-key 参数
示例: python query_models.py <endpoint> --api-key sk-xxx
============================================================
工作流程
当用户给出 API 端点地址时:
- 提取用户提供的 endpoint URL
- 如果用户同时提供了 API Key,使用
--api-key参数 - 运行
python scripts/query_models.py <endpoint> [--api-key KEY] - 将结果以结构化方式呈现给用户
- 如果用户需要,可将结果保存为文件
注意事项
- 不需要 API Key 的端点(如 OpenAI 的公开模型列表)可以直接查询
- 大部分第三方 API 需要 API Key 认证,返回 401/403 时提示用户提供
- 如果查询失败,脚本会尝试多个路径,并给出详细错误信息
- 超时默认 15 秒,慢速 API 可通过
--timeout调整 - 脚本使用 SSL 证书验证关闭模式(
CERT_NONE),兼容自签名证书的 API
资源
scripts/
query_models.py- 核心查询脚本,可直接执行
Current listing version
2.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供根据 API 端点查询可用模型列表的功能,实用性强
- 支持多路径探测、提供商识别、认证支持等高级特性
- 适用于开发者、AI 应用使用者等广泛用户群体
Highlights
- 触发关键词覆盖全面,包括多种常见表达变体
- 边界清晰,能有效区分于其他 Skill
Highlights
- 文档结构完整,包含概述、核心能力、使用方法、参数说明等
- 步骤清晰,有多个端到端示例,frontmatter 完整
Areas to improve
-
引用文件缺失 Reported severity: Minor
SKILL.md 中引用了 scripts/query_models.py 文件,但未在传入内容中提供该文件
Recommendation: 请确保所有被引用的文件都包含在 Skill 包中,或明确说明文件获取方式
Highlights
- 工具来源明确,参数说明清晰
- 覆盖主要异常情况,有详细的错误提示和用户引导
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 24, 43, 45, 50, 73
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- api.deepseek.com
- api.openai.com
- api.slow.com
- api.xxx.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.