TypeScript API 參考文件
建立訊息
client.messages.create(params, options?): Message | Stream<RawMessageStreamEvent>POST/v1/messages
傳送包含文字和/或圖片內容的結構化輸入訊息清單,模型將產生對話中的下一則訊息。
計算訊息中的 Token 數
client.messages.countTokens(params, options?): MessageTokensCountPOST/v1/messages/count_tokens
計算訊息中的 Token 數量。
取得檔案中繼資料
client.files.retrieveMetadata(fileID, params?, options?): FileMetadataGET/v1/files/{file_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?): UserProfilePOST/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?): UserProfileGET/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?): UserProfilePOST/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?): DeletedUserProfileDELETE/v1/user_profiles/{user_profile_id}
Delete a user profile, for example when the end customer closes their account.
取得目前組織
client.organization.retrieve(options?): OrganizationInfoGET/v1/organizations/me
擷取與已驗證 API 金鑰相關聯之組織的資訊。