Responses Agent Flex Tier

Run o4-mini on the flex service tier with the OpenAIResponses model.

OpenAI schedules o3-mini and o4-mini for shutdown on October 23, 2026. The provider lifecycle notice lists their replacements. Check the selected replacement's reasoning and service-tier support before changing the source model ID.

agent_flex_tier.py
"""
Openai Agent Flex Tier
======================

Cookbook example for `openai/responses/agent_flex_tier.py`.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIResponses

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=OpenAIResponses(id="o4-mini", service_tier="flex"),
    markdown=True,
)

agent.print_response("Share a 2 sentence horror story")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno openai

Export your OpenAI API key

export OPENAI_API_KEY="your_openai_api_key_here"

Run the example

Save the code above as agent_flex_tier.py, then run:

python agent_flex_tier.py

Full source: cookbook/90_models/openai/responses/agent_flex_tier.py