Ataraxia is unofficial Python wrapper for Blackbox AI.
Installation
pip install ataraxia
Usage
Chat
fromataraxiaimportBlackbox, Model# Use Models.BLACKBOXAI by defaultblackbox=Blackbox()
response=blackbox.chat('What do you think about gen alpha?') # ChatResponse<CHAT_ID>print(response)
# Chat with imageresponse=blackbox.chat('What do you think about this image?', 'https://example.com/image.png') # from image linkresponse=blackbox.chat('What do you think about this image?', 'QWt1IFBIUA==') # from base64 stringresponse=blackbox.chat('What do you think about this image?', 'data:image/png;base64,QWt1IFBIUA==') # from base64 image dataresponse=blackbox.chat('What do you think about this image?', b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x03\xe8\x00\x00') # from image bytes# Use other model from Modelblackbox=Blackbox(Model.GPT_4O)
# Set system instruction promptblackbox=Blackbox(instruction='You are a gen alpha assistant')
# orblackbox.change_instruction('You are a gen alpha assistant')
# Load chat data and history from saved fileblackbox=Blackbox(chat_id='SAVED_CHAT_ID')
# orblackbox.load_chat('SAVED_CHAT_ID')
# Save chat data and history to JSON fileblackbox.save_chat()
# orblackbox.save_chat('./ataraxia_{CHAT_ID}.json') # {CHAT_ID} will be replaced with current chat id# Change save pathblackbox.change_save_path('filename_{CHAT_ID}.json')
Image Generation (Imagine)
fromataraxiaimportBlackboxblackbox=Blackbox()
result=blackbox.imagine('A pregnant kitten') # ImageResponse<IMAGE_ID>print(result) # https://storage.googleapis.com/...# Download the image to bytesimage_bytes=result.download()
# Save the image to fileresult.save('./imagine.jpg') # True if success False otherwise
Search
fromataraxiaimportBlackboxblackbox=Blackbox()
results=blackbox.search('Schall meaning') # list of SearchResult<TITLE>print(results[0]) # Schall. [ʃal]Maskulinum | masculine m...
Set the saved chat_id to load the history and chat data
No
None
instruction
str
Set the system instruction for every chat request
No
None
auto_save
bool
Will save chat data and history to save_path if True
No
True
save_path
str
File path to save chat data like model, instruction, and history. It is recommended to always insert {CHAT_ID} so that it can be loaded with load_chat()
No
./ataraxia_{CHAT_ID}.json
chat
Param
Type
Description
Required
Default
message
str
Message to send
Yes
-
image
str | bytes
Additional image
No
None
history
list
Chat history
No
[]
max_tokens
int
Response max tokens
No
1024
top_p
float
Probability sampling to determine the selected set of tokens for the response
No
0.9
temperature
float
Set the level of creativity or randomness in the generated response