Skip to main content
This example uses gpt-5.2, but AIMLAPI’s current GPT-5.2 model ID is openai/gpt-5-2. Apply the migration below before running. See AIMLAPI’s GPT-5.2 reference.
basic.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your AI/ML API key

4

Update the AIMLAPI model ID

Replace AIMLAPI(id="gpt-5.2") with AIMLAPI(id="openai/gpt-5-2") in the saved file.
5

Run the example

Save the code above as basic.py, then run:
Full source: cookbook/90_models/aimlapi/basic.py