When working with private instances of OpenAI's models only, e.g. within your Azure environment, AI Router can still help optimize the trade-off between cost and performance. The router analyzes the input to recommend either the more efficient gpt-5-mini or the more capable gpt-5.2 based on the specific requirements of each request.
from airouter import AiRouter, Model
client = AiRouter(
api_key="<THE-API-KEY-YOU-GENERATED>"
)
best_model = client.get_best_model(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the meaning of life?"}
],
model=Model.GPT_5_MINI, # the default model
models=[Model.GPT_5_MINI, Model.GPT_5_2], # the models to consider
)
if best_model == Model.GPT_5_MINI:
# call your private gpt-5-mini deployment
elif best_model == Model.GPT_5_2:
# call your private gpt-5.2 deployment