A complete rewrite of the library recently took place, a lot of things have changed. Developers recommend immediate update. For more information access: Migration Guide

This example shows how to use the Openai client with LlamaAPI

# This example is the new way to use the OpenAI lib for python
from openai import OpenAI

client = OpenAI(
api_key = "<your_llamaapi_token>",
base_url = "https://api.llama-api.com"
)

    response = client.chat.completions.create(
    model="llama-13b-chat",
    messages=[
        {"role": "system", "content": "Assistant is a large language model trained by OpenAI."},
        {"role": "user", "content": "Who were the founders of Microsoft?"}
    ]

)

#print(response)
print(response.model_dump_json(indent=2))
print(response.choices[0].message.content)