Python API reference
Create a Message
messages.create(**kwargs) -> MessageSend 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
messages.count_tokens(**kwargs) -> MessageTokensCountCount the number of tokens in a Message.
Get a Model
models.retrieve(model_id, **kwargs) -> ModelInfoGet a specific model.
Download File
files.download(file_id, **kwargs) -> BinaryResponseContentUser Profiles
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.
Create User Profile
user_profiles.create(**kwargs) -> UserProfileRegister one of your end customers and get the ID to send on the requests you make for them.
List User Profiles
user_profiles.list(**kwargs) -> SyncPageCursor[UserProfile]List the user profiles in your organization, newest first by default.
Get User Profile
user_profiles.retrieve(user_profile_id, **kwargs) -> UserProfileGet a user profile by ID to check the details stored for it.
Update User Profile
user_profiles.update(user_profile_id, **kwargs) -> UserProfileChange the details of a user profile, leaving the fields that you don't send as they are.
Delete User Profile
user_profiles.delete(user_profile_id, **kwargs) -> DeletedUserProfileDelete a user profile, for example when the end customer closes their account.
Get Current Organization
organization.retrieve() -> OrganizationInfoRetrieve information about the organization associated with the authenticated API key.