Claude Platform Docs

Python API 參考文件

建立訊息
messages.create(**kwargs) -> Message
POST/v1/messages

傳送包含文字和/或圖片內容的結構化輸入訊息清單,模型將產生對話中的下一則訊息。

計算訊息中的 Token 數
messages.count_tokens(**kwargs) -> MessageTokensCount
POST/v1/messages/count_tokens

計算訊息中的 Token 數量。

列出模型
models.list(**kwargs) -> SyncPage[ModelInfo]
GET/v1/models

列出可用的模型。

取得模型
models.retrieve(model_id, **kwargs) -> ModelInfo
GET/v1/models/{model_id}

取得特定模型。

上傳檔案
files.upload(**kwargs) -> FileMetadata
POST/v1/files
列出檔案
files.list(**kwargs) -> SyncPageCursor[FileMetadata]
GET/v1/files
下載檔案
files.download(file_id, **kwargs) -> BinaryResponseContent
GET/v1/files/{file_id}/content
取得檔案中繼資料
files.retrieve_metadata(file_id, **kwargs) -> FileMetadata
GET/v1/files/{file_id}
刪除檔案
files.delete(file_id, **kwargs) -> DeletedFile
DELETE/v1/files/{file_id}
建立技能
skills.create(**kwargs) -> Skill
POST/v1/skills
列出技能
skills.list(**kwargs) -> SyncPageCursor[Skill]
GET/v1/skills
取得技能
skills.retrieve(skill_id, **kwargs) -> Skill
GET/v1/skills/{skill_id}
刪除技能
skills.delete(skill_id, **kwargs) -> DeletedSkill
DELETE/v1/skills/{skill_id}

使用者設定檔

Register the end customers that your platform serves, so each request can name who it's for. To get started, see the User profiles guide.

建立使用者設定檔
user_profiles.create(**kwargs) -> UserProfile
POST/v1/user_profiles

Register one of your end customers and get the ID to send on the requests you make for them.

列出使用者設定檔
user_profiles.list(**kwargs) -> SyncPageCursor[UserProfile]
GET/v1/user_profiles

List the user profiles in your organization, newest first by default.

取得使用者設定檔
user_profiles.retrieve(user_profile_id, **kwargs) -> UserProfile
GET/v1/user_profiles/{user_profile_id}

Get a user profile by ID to check the details stored for it.

更新使用者設定檔
user_profiles.update(user_profile_id, **kwargs) -> UserProfile
POST/v1/user_profiles/{user_profile_id}

Change the details of a user profile, leaving the fields that you don't send as they are.

刪除使用者設定檔
user_profiles.delete(user_profile_id, **kwargs) -> DeletedUserProfile
DELETE/v1/user_profiles/{user_profile_id}

Delete a user profile, for example when the end customer closes their account.

取得目前組織
organization.retrieve() -> OrganizationInfo
GET/v1/organizations/me

擷取與已驗證 API 金鑰相關聯之組織的資訊。