PHP API 参考
创建消息
$client->messages->create(int maxTokens, list<MessageParam> messages, Model model, ?CacheControlEphemeral cacheControl, ?MessageCreateParamsContainer container, ?DiagnosticsParam diagnostics, ?string inferenceGeo, ?Metadata metadata, ?OutputConfig outputConfig, ?ServiceTier serviceTier, ?Speed speed, ?list<string> stopSequences, ?System system, ?ThinkingConfigParam thinking, ?ToolChoice toolChoice, ?list<ToolUnion> tools, ?string userProfileID, ?string workspaceID): MessagePOST/v1/messages
发送包含文本和/或图像内容的结构化输入消息列表,模型将生成对话中的下一条消息。
计算消息中的令牌数
$client->messages->countTokens(list<MessageParam> messages, Model model, ?CacheControlEphemeral cacheControl, ?OutputConfig outputConfig, ?Speed speed, ?System system, ?ThinkingConfigParam thinking, ?ToolChoice toolChoice, ?list<MessageCountTokensTool> tools, ?string userProfileID, ?string workspaceID): MessageTokensCountPOST/v1/messages/count_tokens
计算消息中的令牌数量。
上传文件
$client->files->upload(FileParam | string file, ?int expiresInSeconds, ?string workspaceID): FileMetadataPOST/v1/files
列出文件
$client->files->list(?list<string> ids, ?int limit, ?string page, ?string workspaceID): PageCursor<FileMetadata>GET/v1/files
下载文件
$client->files->download(string fileID, ?string workspaceID): downloadGET/v1/files/{file_id}/content
获取文件元数据
$client->files->retrieveMetadata(string fileID, ?string workspaceID): FileMetadataGET/v1/files/{file_id}
删除文件
$client->files->delete(string fileID, ?string workspaceID): DeletedFileDELETE/v1/files/{file_id}
删除技能
$client->skills->delete(string skillID, ?string workspaceID): DeletedSkillDELETE/v1/skills/{skill_id}
创建用户配置文件
$client->userProfiles->create(?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfilePOST/v1/user_profiles
列出用户配置文件
$client->userProfiles->list(?list<UserProfileEnforcementStatus> enforcementStatus, ?int limit, ?UserProfileListOrder order, ?UserProfileListOrderBy orderBy, ?string page, ?string workspaceID): PageCursor<UserProfile>GET/v1/user_profiles
获取用户配置文件
$client->userProfiles->retrieve(string userProfileID, ?string workspaceID): UserProfileGET/v1/user_profiles/{user_profile_id}
更新用户配置文件
$client->userProfiles->update(string userProfileID, ?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfilePOST/v1/user_profiles/{user_profile_id}
删除用户配置文件
$client->userProfiles->delete(string userProfileID, ?string workspaceID): DeletedUserProfileDELETE/v1/user_profiles/{user_profile_id}
获取当前组织
$client->organization->retrieve(): OrganizationInfoGET/v1/organizations/me
检索与经过身份验证的 API 密钥关联的组织的信息。