Python library

We provide a Python library, which you can install by running:

pip install afarensis

Once installed, you can use the library and your secret key to run the following:

from afarensis import Afarensis
client = Afarensis(
    # Defaults to os.environ.get("AFARENSIS_KEY")
)

chat_completion = client.chat.completions.create(
    model="afs-turbo",
    messages=[{"role": "user", "content": "Hello world"}]
)

The bindings also will install a command-line utility you can use as follows:

$ afarensis api chat_completions.create -m afs-turbo -g user "Hello world"

TypeScript / JavaScript library

We provide a TypeScript / JavaScript library with support for Node.js and various other runtimes. Install it by running:

npm install --save afarensis
# or
yarn add afarensis

最后更新于