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
傳送包含文字和/或圖片內容的結構化輸入訊息清單,模型將產生對話中的下一則訊息。
計算訊息中的 Token 數
$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
計算訊息中的 Token 數量。
上傳檔案
$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 金鑰相關聯之組織的資訊。