获取特定模型。
Models API 响应可用于确定特定模型的相关信息,或将模型别名解析为模型 ID。
Parameters
Returns
获取模型
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ.get(
"ANTHROPIC_API_KEY"
), # This is the default and can be omitted
)
beta_model_info = client.beta.models.retrieve(
model_id="model_id",
)
print(beta_model_info.id)Response 200
{
"id": "claude-opus-5",
"allowed_fallback_models": [
"string"
],
"capabilities": {
"batch": {
"supported": true
},
"citations": {
"supported": true
},
"code_execution": {
"supported": true
},
"compaction": {
"summarize": {
"supported": true
},
"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
},
"server_tools": {
"code_execution": {
"supported": true
},
"supported": true,
"web_search": {
"supported": true
}
},
"structured_outputs": {
"supported": true
},
"thinking": {
"supported": true,
"types": {
"adaptive": {
"supported": true
},
"disabled": {
"supported": true
},
"enabled": {
"supported": true
}
}
}
},
"created_at": "2026-07-24T00:00:00Z",
"deprecated_at": "2019-12-27T18:11:19.117Z",
"display_name": "Claude Opus 5",
"lifecycle": "active",
"line": "haiku",
"max_input_tokens": 0,
"max_tokens": 0,
"retires_at": "2019-12-27T18:11:19.117Z",
"type": "model"
}Returns Examples
Response 200
{
"id": "claude-opus-5",
"allowed_fallback_models": [
"string"
],
"capabilities": {
"batch": {
"supported": true
},
"citations": {
"supported": true
},
"code_execution": {
"supported": true
},
"compaction": {
"summarize": {
"supported": true
},
"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
},
"server_tools": {
"code_execution": {
"supported": true
},
"supported": true,
"web_search": {
"supported": true
}
},
"structured_outputs": {
"supported": true
},
"thinking": {
"supported": true,
"types": {
"adaptive": {
"supported": true
},
"disabled": {
"supported": true
},
"enabled": {
"supported": true
}
}
}
},
"created_at": "2026-07-24T00:00:00Z",
"deprecated_at": "2019-12-27T18:11:19.117Z",
"display_name": "Claude Opus 5",
"lifecycle": "active",
"line": "haiku",
"max_input_tokens": 0,
"max_tokens": 0,
"retires_at": "2019-12-27T18:11:19.117Z",
"type": "model"
}