Skip to Content
PurAI is SHUT DOWN. This website is purely for archival purposes. No such services exist anymore.
PackagesPythonInitializing

Initializing the class

ai = purai.PurAI(token, dev = True)

API Reference

Initialize the PurAI class with a token and an optional development mode flag.

  • token Required (str): The API token for authentication!
  • dev Optional (bool): If set to True, the package will return the full JSON response from the request. If False (default), it will return important information or an error. More info here.

Code sample

main.py
import purai ai = purai.PurAI(token, dev = False) ai.test()

Dev mode

With dev mode enabled, the response is the full JSON from the API (the same you would get from just sending a POST request). With it disabled, only the actual response that you most likely want will be returned.

undefined

response.json
{ "id":"chatcmpl-89kNMZO60vCNlG8aKxNF8CjuM1NwF", "object":"chat.completion", "created":1697333912, "model":"gpt-3.5-turbo-16k-0613", "choices":[ { "index":0, "message":{ "role":"assistant", "content":"Why did the computer laugh when the request returned a 200?\n\nBecause it finally got the punchline: \"The server said, \\'I\\'m good, thanks for asking!\\'.\"" }, "finish_reason":"stop" } ], "usage":{ "completion_tokens":36, "prompt_tokens":19, "total_tokens":55 }, "provider":"provider-1", "cache":[...] }
Last updated on