Loading...
    • 開發者指南
    • API 參考
    • MCP
    • 資源
    • 發行說明
    Search...
    ⌘K

    第一步

    Claude 介紹快速入門

    模型與定價

    模型概覽選擇模型Claude 4.5 的新功能遷移到 Claude 4.5模型棄用定價

    使用 Claude 建構

    功能概覽使用 Messages API上下文視窗提示詞最佳實踐

    功能

    提示詞快取上下文編輯延伸思考串流訊息批次處理引用多語言支援Token 計數嵌入向量視覺PDF 支援Files API搜尋結果Google Sheets 附加元件

    工具

    概述如何實現工具使用代幣高效工具使用細粒度工具串流Bash 工具代碼執行工具電腦使用工具文字編輯工具網頁擷取工具網路搜尋工具記憶工具

    代理技能

    概述在 API 中開始使用 Agent Skills技能編寫最佳實踐使用 Agent Skills 與 API

    Agent SDK

    概述Agent SDK 參考 - TypeScriptPython SDK

    指南

    串流輸入處理權限會話管理託管 Agent SDK修改系統提示SDK 中的 MCP自訂工具SDK 中的子代理SDK 中的斜線命令SDK 中的代理技能追蹤成本和使用量待辦事項清單SDK 中的外掛程式

    API 中的 MCP

    MCP 連接器遠端 MCP 伺服器

    Claude 在第三方平台上

    Amazon BedrockVertex AI

    提示工程

    概述提示詞生成器使用提示模板提示詞改進器保持清晰和直接使用範例(多樣提示)讓 Claude 思考(思維鏈)使用 XML 標籤給 Claude 分配角色(系統提示詞)預填 Claude 的回應串接複雜提示長文本技巧延伸思考技巧

    測試與評估

    定義成功標準開發測試案例使用評估工具降低延遲

    加強防護措施

    減少幻覺提高輸出一致性防範越獄handle-streaming-refusals減少提示詞洩漏保持 Claude 的角色特性

    管理和監控

    Admin API 概述使用量和成本 APIClaude Code 分析 API
    Console
    管理和監控

    Admin API 概述

    The Admin API is unavailable for individual accounts. To collaborate with teammates and add members, set up your organization in Console → Settings → Organization.

    Admin API 允許您以程式化方式管理組織的資源,包括組織成員、工作區和 API 金鑰。這提供了對管理任務的程式化控制,否則需要在 Claude Console 中手動配置。

    Admin API 需要特殊存取權限

    Admin API 需要特殊的 Admin API 金鑰(以 sk-ant-admin... 開頭),這與標準 API 金鑰不同。只有具有管理員角色的組織成員才能透過 Claude Console 提供 Admin API 金鑰。

    Admin API 如何運作

    當您使用 Admin API 時:

    1. 您在 x-api-key 標頭中使用您的 Admin API 金鑰發出請求
    2. API 允許您管理:
      • 組織成員及其角色
      • 組織成員邀請
      • 工作區及其成員
      • API 金鑰

    這對以下用途很有用:

    • 自動化使用者入職/離職
    • 以程式化方式管理工作區存取
    • 監控和管理 API 金鑰使用情況

    組織角色和權限

    有五個組織層級的角色。請參閱此處的更多詳細資訊。

    角色權限
    user可以使用 Workbench
    claude_code_user可以使用 Workbench 和 Claude Code
    developer可以使用 Workbench 並管理 API 金鑰
    billing可以使用 Workbench 並管理帳單詳細資訊
    admin可以執行上述所有操作,以及管理使用者

    關鍵概念

    組織成員

    您可以列出組織成員、更新成員角色和移除成員。

    Shell
    # 列出組織成員
    curl "https://api.anthropic.com/v1/organizations/users?limit=10" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
    
    # 更新成員角色
    curl "https://api.anthropic.com/v1/organizations/users/{user_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{"role": "developer"}'
    
    # 移除成員
    curl --request DELETE "https://api.anthropic.com/v1/organizations/users/{user_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

    組織邀請

    您可以邀請使用者加入組織並管理這些邀請。

    # 建立邀請
    curl --request POST "https://api.anthropic.com/v1/organizations/invites" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{
        "email": "[email protected]",
        "role": "developer"
      }'
    
    # 列出邀請
    curl "https://api.anthropic.com/v1/organizations/invites?limit=10" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
    
    # 刪除邀請
    curl --request DELETE "https://api.anthropic.com/v1/organizations/invites/{invite_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

    工作區

    建立和管理工作區(控制台)以組織您的資源:

    # 建立工作區
    curl --request POST "https://api.anthropic.com/v1/organizations/workspaces" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{"name": "Production"}'
    
    # 列出工作區
    curl "https://api.anthropic.com/v1/organizations/workspaces?limit=10&include_archived=false" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
    
    # 封存工作區
    curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/archive" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

    工作區成員

    管理使用者對特定工作區的存取:

    # 將成員新增至工作區
    curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{
        "user_id": "user_xxx",
        "workspace_role": "workspace_developer"
      }'
    
    # 列出工作區成員
    curl "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members?limit=10" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
    
    # 更新成員角色
    curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{
        "workspace_role": "workspace_admin"
      }'
    
    # 從工作區移除成員
    curl --request DELETE "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

    API 金鑰

    監控和管理 API 金鑰:

    # 列出 API 金鑰
    curl "https://api.anthropic.com/v1/organizations/api_keys?limit=10&status=active&workspace_id=wrkspc_xxx" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
    
    # 更新 API 金鑰
    curl --request POST "https://api.anthropic.com/v1/organizations/api_keys/{api_key_id}" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
      --data '{
        "status": "inactive",
        "name": "New Key Name"
      }'

    存取組織資訊

    使用 /v1/organizations/me 端點以程式化方式取得有關您組織的資訊。

    例如:

    curl "https://api.anthropic.com/v1/organizations/me" \
      --header "anthropic-version: 2023-06-01" \
      --header "x-api-key: $ADMIN_API_KEY"
    {
      "id": "12345678-1234-5678-1234-567812345678",
      "type": "organization",
      "name": "Organization Name"
    }

    此端點對於以程式化方式確定 Admin API 金鑰屬於哪個組織很有用。

    有關完整的參數詳細資訊和回應架構,請參閱組織資訊 API 參考。

    存取使用情況和成本報告

    要存取您組織的使用情況和成本報告,請使用使用情況和成本 API 端點:

    • 使用情況端點(/v1/organizations/usage_report/messages)提供詳細的使用情況資料,包括權杖計數和請求指標,按各種維度(如工作區、使用者和模型)分組。
    • 成本端點(/v1/organizations/cost_report)提供與您組織使用情況相關的成本資料,讓您能夠追蹤支出並按工作區或描述分配成本。

    這些端點提供對您組織使用情況和相關成本的詳細洞察。

    存取 Claude Code 分析

    對於使用 Claude Code 的組織,Claude Code Analytics API 提供詳細的生產力指標和使用情況洞察:

    • Claude Code Analytics 端點(/v1/organizations/usage_report/claude_code)提供 Claude Code 使用情況的每日聚合指標,包括會話、程式碼行數、提交、拉取請求、工具使用統計資料,以及按使用者和模型細分的成本資料。

    此 API 讓您能夠追蹤開發人員生產力、分析 Claude Code 採用情況,並為您的組織建立自訂儀表板。

    最佳實務

    要有效使用 Admin API:

    • 為工作區和 API 金鑰使用有意義的名稱和描述
    • 為失敗的操作實作適當的錯誤處理
    • 定期稽核成員角色和權限
    • 清理未使用的工作區和過期的邀請
    • 監控 API 金鑰使用情況並定期輪換金鑰

    常見問題

    • Admin API 如何運作
    • API 金鑰
    • 存取 Claude Code 分析
    © 2025 ANTHROPIC PBC

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    © 2025 ANTHROPIC PBC