Use in the official OpenAI library.
This section provides the latest method for calling the OpenAI package.
from openai import OpenAI
client = OpenAI(
    api_key="sk-***",
    base_url="https://aihubmix.com/v1"
)
chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Say this is a test",
        }
    ],
    model="gpt-4o-mini-2024-07-18",
)
print(chat_completion)
Other methods are the same as the official ones, just change the URL and key to use ours; for the specific API calling method, please refer to the official documentation.