# Models API — 模型查询 Source: https://ofox.io/zh/docs/api/openai/models 列出和查询 OfoxAI 平台上所有可用的模型。返回的数据遵循 OpenRouter 标准,包含模型的完整元数据:架构、定价、支持参数等。 Models API 是公开接口,无需 API Key 即可调用。关于响应中各字段的详细说明,请参阅 [模型目录 — Models API 标准](https://ofox.io/zh/docs/develop/models#models-api-标准)。 ## 列出所有模型 ```http GET https://api.ofox.io/v1/models ``` ### 请求示例 **cURL** ```bash filename="Terminal" curl https://api.ofox.io/v1/models ``` **Python** ```python filename="models.py" showLineNumbers import requests resp = requests.get("https://api.ofox.io/v1/models") for model in resp.json()["data"]: print(model["id"]) ``` **TypeScript** ```typescript filename="models.ts" showLineNumbers const resp = await fetch('https://api.ofox.io/v1/models') const { data } = await resp.json() for (const model of data) { console.log(model.id) } ``` ### 响应格式 ```json { "object": "list", "data": [ { "id": "anthropic/claude-sonnet-5.5", "object": "model", "created": 1790553600, "owned_by": "bedrock", "canonical_slug": "claude-sonnet-5-5", "name": "Anthropic: Claude Sonnet 5.5", "description": "Claude Sonnet 5.5 is Anthropic's Sonnet-tier model, offering a balance of speed and intelligence for coding, reasoning, and agentic workloads. It supports text, image, and file inputs with text output, with a 1M-token context window and up to 128K output tokens, at a lower per-token price than Claude Opus 5.5.", "context_length": 1000000, "architecture": { "modality": "text+image+file->text", "input_modalities": [ "text", "image", "file" ], "output_modalities": [ "text" ], "tokenizer": "claude", "instruct_type": null }, "pricing": { "prompt": "0.000002", "completion": "0.00001", "input_cache_read": "0.0000002", "input_cache_write_5m": "0.0000025", "input_cache_write_1h": "0.000004", "web_search": "0.015" }, "top_provider": { "context_length": 1000000, "max_completion_tokens": 128000, "is_moderated": false }, "per_request_limits": null, "supported_parameters": [ "temperature", "top_p", "max_tokens", "stop", "tools", "tool_choice", "response_format", "reasoning" ], "default_parameters": null, "expiration_date": null, "is_deprecated": false, "supported_endpoints": [ "/v1/chat/completions", "/v1/responses" ], "aliases": [ "claude-sonnet-5-5", "claude-sonnet-5.5" ] } ] } ``` ### 响应字段说明 | 字段 | 类型 | 说明 | |------|------|------| | `id` | string | 模型标识符,如 `"anthropic/claude-sonnet-5.5"` | | `canonical_slug` | string | 永久标识符,不会变更 | | `name` | string | 模型显示名称 | | `created` | number | 添加时间(Unix 时间戳) | | `description` | string | 模型能力描述 | | `context_length` | number | 最大上下文窗口(token) | | `architecture` | object | 输入/输出模态、分词器信息 | | `pricing` | object | 定价(美元/token) | | `top_provider` | object | 供应商配置(上下文限制、最大输出等) | | `supported_parameters` | string[] | 支持的 API 参数 | ## 按供应商过滤模型 ```http GET https://api.ofox.io/v1/models/{provider} ``` 仅返回指定供应商的模型列表。 ### 路径参数 | 参数 | 类型 | 说明 | |------|------|------| | `provider` | string | 供应商标识,如 `anthropic`、`openai`、`google`、`qwen`、`volcengine` | ### 请求示例 ```bash filename="Terminal" # 列出所有 Anthropic 模型 curl https://api.ofox.io/v1/models/anthropic # 列出所有 OpenAI 模型 curl https://api.ofox.io/v1/models/openai ``` ### 响应格式 返回格式与列出所有模型一致,`data` 数组仅包含指定供应商的模型。 ## 获取模型详情 ```http GET https://api.ofox.io/v1/models/{provider}/{model_id} ``` ### 路径参数 | 参数 | 类型 | 说明 | |------|------|------| | `provider` | string | 供应商标识,如 `anthropic` | | `model_id` | string | 模型名称,如 `claude-sonnet-5.5` | ### 请求示例 ```bash filename="Terminal" curl https://api.ofox.io/v1/models/anthropic/claude-sonnet-5.5 ``` ### 响应格式 返回单个 Model 对象,结构与列表接口中的对象一致。