Claude Platform Docs

TypeScript API 參考文件

建立訊息
client.messages.create(params, options?): Message | Stream<RawMessageStreamEvent>
POST/v1/messages

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

計算訊息中的 Token 數
client.messages.countTokens(params, options?): MessageTokensCount
POST/v1/messages/count_tokens

計算訊息中的 Token 數量。

列出模型
client.models.list(params?, options?): Page<ModelInfo>
GET/v1/models

列出可用的模型。

取得模型
client.models.retrieve(modelID, params?, options?): ModelInfo
GET/v1/models/{model_id}

取得特定模型。

上傳檔案
client.files.upload(params, options?): FileMetadata
POST/v1/files
列出檔案
client.files.list(params?, options?): PageCursor<FileMetadata>
GET/v1/files
下載檔案
client.files.download(fileID, params?, options?): Response
GET/v1/files/{file_id}/content
取得檔案中繼資料
client.files.retrieveMetadata(fileID, params?, options?): FileMetadata
GET/v1/files/{file_id}
刪除檔案
client.files.delete(fileID, params?, options?): DeletedFile
DELETE/v1/files/{file_id}
建立技能
client.skills.create(params, options?): Skill
POST/v1/skills
列出技能
client.skills.list(params?, options?): PageCursor<Skill>
GET/v1/skills
取得技能
client.skills.retrieve(skillID, params?, options?): Skill
GET/v1/skills/{skill_id}
刪除技能
client.skills.delete(skillID, params?, options?): 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.

建立使用者設定檔
client.userProfiles.create(params, options?): UserProfile
POST/v1/user_profiles

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

列出使用者設定檔
client.userProfiles.list(params?, options?): PageCursor<UserProfile>
GET/v1/user_profiles

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

取得使用者設定檔
client.userProfiles.retrieve(userProfileID, params?, options?): UserProfile
GET/v1/user_profiles/{user_profile_id}

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

更新使用者設定檔
client.userProfiles.update(userProfileID, params, options?): 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.

刪除使用者設定檔
client.userProfiles.delete(userProfileID, params?, options?): DeletedUserProfile
DELETE/v1/user_profiles/{user_profile_id}

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

取得目前組織
client.organization.retrieve(options?): OrganizationInfo
GET/v1/organizations/me

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