Ruby API 參考文件
計算訊息中的 Token 數
messages.count_tokens(**kwargs) -> MessageTokensCountPOST/v1/messages/count_tokens
計算訊息中的 Token 數量。
串流
messages.stream(**kwargs) -> Anthropic::Helpers::Streaming::MessageStreamFunction
以與 stream_raw 相同的方式串流訊息,並回傳一個 MessageStream,該物件會累積串流事件,並剖析工具輸入與結構化輸出。
建立使用者設定檔
user_profiles.create(**kwargs) -> UserProfilePOST/v1/user_profiles
註冊您的一位終端客戶,並取得 ID,以便在您代其發出的請求中傳送。
列出使用者設定檔
user_profiles.list(**kwargs) -> PageCursor<UserProfile>GET/v1/user_profiles
列出您組織中的使用者設定檔,預設以最新的優先排列。
取得使用者設定檔
user_profiles.retrieve(user_profile_id, **kwargs) -> UserProfileGET/v1/user_profiles/{user_profile_id}
依 ID 取得使用者設定檔,以檢查為其儲存的詳細資訊。
更新使用者設定檔
user_profiles.update(user_profile_id, **kwargs) -> UserProfilePOST/v1/user_profiles/{user_profile_id}
變更使用者設定檔的詳細資訊,您未傳送的欄位將維持不變。
刪除使用者設定檔
user_profiles.delete(user_profile_id, **kwargs) -> DeletedUserProfileDELETE/v1/user_profiles/{user_profile_id}
刪除使用者設定檔,例如在終端客戶關閉其帳戶時。