TypeScript API 参考
创建消息
client.messages.create(params, options?): Message | Stream<RawMessageStreamEvent>POST/v1/messages
发送包含文本和/或图像内容的结构化输入消息列表,模型将生成对话中的下一条消息。
计算消息中的令牌数
client.messages.countTokens(params, options?): MessageTokensCountPOST/v1/messages/count_tokens
计算消息中的令牌数量。
用户配置文件
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 密钥关联的组织的信息。