Claude Platform Docs

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): Message
POST/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): MessageTokensCount
POST/v1/messages/count_tokens

计算消息中的令牌数量。

列出模型
$client->models->list(?string afterID, ?string beforeID, ?list<Lifecycle> lifecycle, ?int limit, ?string workspaceID): Page<ModelInfo>
GET/v1/models

列出可用模型。

获取模型
$client->models->retrieve(string modelID, ?string workspaceID): ModelInfo
GET/v1/models/{model_id}

获取特定模型。

上传文件
$client->files->upload(FileParam | string file, ?int expiresInSeconds, ?string workspaceID): FileMetadata
POST/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): download
GET/v1/files/{file_id}/content
获取文件元数据
$client->files->retrieveMetadata(string fileID, ?string workspaceID): FileMetadata
GET/v1/files/{file_id}
删除文件
$client->files->delete(string fileID, ?string workspaceID): DeletedFile
DELETE/v1/files/{file_id}
创建技能
$client->skills->create(list<FileParam | string> files, ?string displayName, ?string workspaceID): Skill
POST/v1/skills
列出技能
$client->skills->list(?int limit, ?string page, ?string source, ?string workspaceID): PageCursor<Skill>
GET/v1/skills
获取技能
$client->skills->retrieve(string skillID, ?string workspaceID): Skill
GET/v1/skills/{skill_id}
删除技能
$client->skills->delete(string skillID, ?string workspaceID): DeletedSkill
DELETE/v1/skills/{skill_id}
创建用户配置文件
$client->userProfiles->create(?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfile
POST/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): UserProfile
GET/v1/user_profiles/{user_profile_id}
更新用户配置文件
$client->userProfiles->update(string userProfileID, ?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfile
POST/v1/user_profiles/{user_profile_id}
删除用户配置文件
$client->userProfiles->delete(string userProfileID, ?string workspaceID): DeletedUserProfile
DELETE/v1/user_profiles/{user_profile_id}
获取当前组织
$client->organization->retrieve(): OrganizationInfo
GET/v1/organizations/me

检索与经过身份验证的 API 密钥关联的组织的信息。