English ← MyDocs

列出模型

get /v1/models

列出可用模型。

Models API 响应可用于确定哪些模型可供 API 使用。最近发布的模型会排在前面。

查询参数

  • after_id: optional string

    用作分页游标的对象 ID。提供时,返回此对象之后的结果页。

  • before_id: optional string

    用作分页游标的对象 ID。提供时,返回此对象之前的结果页。

  • limit: optional number

    每页返回的项目数。

    默认为 20。范围从 11000

请求头参数

  • "anthropic-beta": optional array of AnthropicBeta

    可选的请求头,用于指定要使用的 beta 版本。

    • string

    • "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 22 more

      • "message-batches-2024-09-24"

      • "prompt-caching-2024-07-31"

      • "computer-use-2024-10-22"

      • "computer-use-2025-01-24"

      • "pdfs-2024-09-25"

      • "token-counting-2024-11-01"

      • "token-efficient-tools-2025-02-19"

      • "output-128k-2025-02-19"

      • "files-api-2025-04-14"

      • "mcp-client-2025-04-04"

      • "mcp-client-2025-11-20"

      • "dev-full-thinking-2025-05-14"

      • "interleaved-thinking-2025-05-14"

      • "code-execution-2025-05-22"

      • "extended-cache-ttl-2025-04-11"

      • "context-1m-2025-08-07"

      • "context-management-2025-06-27"

      • "model-context-window-exceeded-2025-08-26"

      • "skills-2025-10-02"

      • "fast-mode-2026-02-01"

      • "output-300k-2026-03-24"

      • "user-profiles-2026-03-24"

      • "advisor-tool-2026-03-01"

      • "managed-agents-2026-04-01"

      • "cache-diagnosis-2026-04-07"

返回值

  • data: array of ModelInfo

    • id: string

      唯一模型标识符。

    • capabilities: ModelCapabilities

      模型能力信息。

      • batch: CapabilitySupport

        模型是否支持 Batch API。

        • supported: boolean

          该模型是否支持此能力。

      • citations: CapabilitySupport

        模型是否支持引用生成。

      • code_execution: CapabilitySupport

        模型是否支持代码执行工具。

      • context_management: ContextManagementCapability

        上下文管理支持及可用策略。

        • clear_thinking_20251015: CapabilitySupport

          指示是否支持该能力。

        • clear_tool_uses_20250919: CapabilitySupport

          指示是否支持该能力。

        • compact_20260112: CapabilitySupport

          指示是否支持该能力。

        • supported: boolean

          该模型是否支持此能力。

      • effort: EffortCapability

        推理努力(reasoning_effort)支持及可用级别。

        • high: CapabilitySupport

          模型是否支持高努力级别。

        • low: CapabilitySupport

          模型是否支持低努力级别。

        • max: CapabilitySupport

          模型是否支持最大努力级别。

        • medium: CapabilitySupport

          模型是否支持中等努力级别。

        • supported: boolean

          该模型是否支持此能力。

        • xhigh: CapabilitySupport

          指示是否支持该能力。

      • image_input: CapabilitySupport

        模型是否接受图像内容块。

      • pdf_input: CapabilitySupport

        模型是否接受 PDF 内容块。

      • structured_outputs: CapabilitySupport

        模型是否支持结构化输出 / JSON 模式 / 严格工具模式。

      • thinking: ThinkingCapability

        思考能力及支持的类型配置。

        • supported: boolean

          该模型是否支持此能力。

        • types: ThinkingTypes

          支持的思考类型配置。

          • adaptive: CapabilitySupport

            模型是否支持类型为 'adaptive'(自动)的思考。

          • enabled: CapabilitySupport

            模型是否支持类型为 'enabled' 的思考。

    • created_at: string

      RFC 3339 日期时间字符串,表示模型发布时间。如果发布日期未知,可能设置为纪元值。

    • display_name: string

      模型的人类可读名称。

    • max_input_tokens: number

      此模型的最大输入上下文窗口大小(以 token 为单位)。

    • max_tokens: number

      使用此模型时 max_tokens 参数的最大值。

    • type: "model"

      对象类型。

      对于模型,始终为 "model"

      • "model"
  • first_id: string

    data 列表中的第一个 ID。可用作上一页的 before_id

  • has_more: boolean

    指示在请求的页面方向上是否有更多结果。

  • last_id: string

    data 列表中的最后一个 ID。可用作下一页的 after_id

示例

curl https://api.anthropic.com/v1/models \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_API_KEY"

响应

{
  "data": [
    {
      "id": "claude-opus-4-6",
      "capabilities": {
        "batch": {
          "supported": true
        },
        "citations": {
          "supported": true
        },
        "code_execution": {
          "supported": true
        },
        "context_management": {
          "clear_thinking_20251015": {
            "supported": true
          },
          "clear_tool_uses_20250919": {
            "supported": true
          },
          "compact_20260112": {
            "supported": true
          },
          "supported": true
        },
        "effort": {
          "high": {
            "supported": true
          },
          "low": {
            "supported": true
          },
          "max": {
            "supported": true
          },
          "medium": {
            "supported": true
          },
          "supported": true,
          "xhigh": {
            "supported": true
          }
        },
        "image_input": {
          "supported": true
        },
        "pdf_input": {
          "supported": true
        },
        "structured_outputs": {
          "supported": true
        },
        "thinking": {
          "supported": true,
          "types": {
            "adaptive": {
              "supported": true
            },
            "enabled": {
              "supported": true
            }
          }
        }
      },
      "created_at": "2026-02-04T00:00:00Z",
      "display_name": "Claude Opus 4.6",
      "max_input_tokens": 0,
      "max_tokens": 0,
      "type": "model"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id"
}