文档提示:本目录为静态文档,接口示例与 OpenAPI 地址已固定为 https://api.xiexus.cn
AI 模型接口 模型(Models) 原生OpenAI格式

原生OpenAI格式

获取当前可用的模型列表。 根据请求头自动识别返回格式: - 包含 `x-api-key` 和 `anthropic-version` 头时返回 Anthropic 格式 - 包含 `x-goog-api-key` 头或 `key` 查询参数时返回 Gemini 格式 - 其他情况返回 OpenAI 格式

GET
https://api.xiexus.cn/v1/models
请求体:无
接口信息
方法
GET
路径
/v1/models
完整地址
https://api.xiexus.cn/v1/models
请求体
标签
模型(Models)/列出模型
响应码
200401
当前接口页内已嵌入 OpenAPI JSON;如果需要查看总文件,可直接打开固定静态文件 relay.json
当前 JSON
../../../openapi/generated/ai-model/模型(Models)/列出模型/get-v1-models-listmodels-383826468.json
总文件
../../../openapi/relay.json

OpenAPI JSON

已将服务地址固定为 https://api.xiexus.cn,其余结构保持和源文档一致。
{
  "openapi": "3.1.0",
  "info": {
    "title": "原生OpenAI格式",
    "version": "1.0.0",
    "description": "获取当前可用的模型列表。\n\n根据请求头自动识别返回格式:\n- 包含 `x-api-key` 和 `anthropic-version` 头时返回 Anthropic 格式\n- 包含 `x-goog-api-key` 头或 `key` 查询参数时返回 Gemini 格式\n- 其他情况返回 OpenAI 格式\n"
  },
  "tags": [
    {
      "name": "模型(Models)/列出模型"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "使用 Bearer Token 认证。\n格式: `Authorization: Bearer sk-xxxxxx`\n"
      }
    }
  },
  "paths": {
    "/v1/models": {
      "get": {
        "tags": [
          "模型(Models)/列出模型"
        ],
        "summary": "原生OpenAI格式",
        "description": "获取当前可用的模型列表。\n\n根据请求头自动识别返回格式:\n- 包含 `x-api-key` 和 `anthropic-version` 头时返回 Anthropic 格式\n- 包含 `x-goog-api-key` 头或 `key` 查询参数时返回 Gemini 格式\n- 其他情况返回 OpenAI 格式\n",
        "operationId": "listmodels",
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": false,
            "description": "Google API Key (用于 Gemini 格式)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "description": "Anthropic API Key (用于 Claude 格式)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "description": "Anthropic API 版本",
            "schema": {
              "type": "string",
              "examples": [
                "2023-06-01"
              ]
            }
          },
          {
            "name": "x-goog-api-key",
            "in": "header",
            "required": false,
            "description": "Google API Key (用于 Gemini 格式)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功获取模型列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "examples": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "模型 ID",
                            "examples": [
                              "gpt-4"
                            ]
                          },
                          "object": {
                            "type": "string",
                            "description": "对象类型",
                            "examples": [
                              "model"
                            ]
                          },
                          "created": {
                            "type": "integer",
                            "description": "创建时间戳"
                          },
                          "owned_by": {
                            "type": "string",
                            "description": "模型所有者",
                            "examples": [
                              "openai"
                            ]
                          }
                        },
                        "x-apifox-orders": [
                          "id",
                          "object",
                          "created",
                          "owned_by"
                        ]
                      }
                    }
                  },
                  "x-apifox-orders": [
                    "object",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "认证失败",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "description": "错误信息"
                        },
                        "type": {
                          "type": "string",
                          "description": "错误类型"
                        },
                        "param": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "相关参数"
                        },
                        "code": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "错误代码"
                        }
                      },
                      "x-apifox-orders": [
                        "message",
                        "type",
                        "param",
                        "code"
                      ]
                    }
                  },
                  "x-apifox-orders": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.xiexus.cn",
      "description": "固定生产地址"
    }
  ]
}