Here is the latest OpenAI package usage guide.

Simply configure the forwarding base_url and your AiHubMix token within the client. This configuration is compatible with all models on the AiHubMix platform.

Python
from openai import OpenAI

client = OpenAI(
    api_key="AIHUBMIX_API_KEY", # Replace with the key you generated in AiHubMix
    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",
)

print(chat_completion)

OpenAI official current service status check