PHP API reference
Create a Message
$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
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
Count tokens in a Message
$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
Count the number of tokens in a Message.
List Models
$client->models->list(?string afterID, ?string beforeID, ?list<Lifecycle> lifecycle, ?int limit, ?string workspaceID): Page<ModelInfo>GET/v1/models
List available models.
Get a Model
$client->models->retrieve(string modelID, ?string workspaceID): ModelInfoGET/v1/models/{model_id}
Get a specific model.
Upload File
$client->files->upload(FileParam | string file, ?int expiresInSeconds, ?string workspaceID): FileMetadataPOST/v1/files
List Files
$client->files->list(?list<string> ids, ?int limit, ?string page, ?string workspaceID): PageCursor<FileMetadata>GET/v1/files
Download File
$client->files->download(string fileID, ?string workspaceID): downloadGET/v1/files/{file_id}/content
Get File Metadata
$client->files->retrieveMetadata(string fileID, ?string workspaceID): FileMetadataGET/v1/files/{file_id}
Delete File
$client->files->delete(string fileID, ?string workspaceID): DeletedFileDELETE/v1/files/{file_id}
Create Skill
$client->skills->create(list<FileParam | string> files, ?string displayName, ?string workspaceID): SkillPOST/v1/skills
List Skills
$client->skills->list(?int limit, ?string page, ?string source, ?string workspaceID): PageCursor<Skill>GET/v1/skills
Delete Skill
$client->skills->delete(string skillID, ?string workspaceID): DeletedSkillDELETE/v1/skills/{skill_id}
Create User Profile
$client->userProfiles->create(?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfilePOST/v1/user_profiles
List User Profiles
$client->userProfiles->list(?list<UserProfileEnforcementStatus> enforcementStatus, ?int limit, ?UserProfileListOrder order, ?UserProfileListOrderBy orderBy, ?string page, ?string workspaceID): PageCursor<UserProfile>GET/v1/user_profiles
Get User Profile
$client->userProfiles->retrieve(string userProfileID, ?string workspaceID): UserProfileGET/v1/user_profiles/{user_profile_id}
Update User Profile
$client->userProfiles->update(string userProfileID, ?UserProfileAccessType accessType, ?UserProfileExternalUserDetailsParams externalUserDetails, ?array<string,string> metadata, ?string name, ?string workspaceID): UserProfilePOST/v1/user_profiles/{user_profile_id}
Delete User Profile
$client->userProfiles->delete(string userProfileID, ?string workspaceID): DeletedUserProfileDELETE/v1/user_profiles/{user_profile_id}
Get Current Organization
$client->organization->retrieve(): OrganizationInfoGET/v1/organizations/me
Retrieve information about the organization associated with the authenticated API key.