Skip to main content
Prompt optimization (GEPA) supports the following policy models:

OpenAI

Models: gpt-5, gpt-5-mini, gpt-5-nano, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini Notes: Policy models for GEPA/MIPRO. gpt-5-pro is excluded.

OpenAI (Image)

Models: gpt-image-1.5, gpt-image-1, gpt-image-1-mini, chatgpt-image-latest Notes: Image generation. See Image Models.

Groq

Models: openai/gpt-oss-20b, openai/gpt-oss-120b, meta/llama-3.3-70b-versatile, qwen/qwen3-32b, meta/llama-3.1-8b-instant Notes: Configure provider credentials in the API.

Google

Models: gemini-2.5-pro, gemini-2.5-pro-gt200k, gemini-2.5-flash, gemini-2.5-flash-lite Notes: Use as policy models where latency/cost fit.

Google (Image)

Models: gemini-2.5-flash-image, gemini-3-pro-image-preview Notes: Image generation. See Image Models.

Image Generation Models

Image generation models can be used as policy models in GEPA and Graph Opt to optimize prompts that generate images. These models return images (as base64 data URLs) instead of text, enabling optimization jobs for visual content generation.

Supported Image Models

OpenAI:
  • gpt-image-1.5 - Latest OpenAI image generation model
  • gpt-image-1 - Previous version
  • gpt-image-1-mini - Cost-efficient version
  • chatgpt-image-latest - Model used in ChatGPT (same as gpt-image-1.5)
Google/Gemini:
  • gemini-2.5-flash-image - Fast image generation (Nano Banana)
  • gemini-3-pro-image-preview - Gemini 3 pro image generation

Using Image Generation Models

When using an image generation model as your policy model, the rollout function receives image data (base64 encoded) in the response. Extract the image from the multipart content:
# In your rollout function
response = await call_policy_model(messages, inference_url)

# Extract image from response
choices = response.get("choices", [])
if choices:
    message = choices[0].get("message", {})
    content = message.get("content", [])
    
    for part in content:
        if part.get("type") == "image_url":
            image_url = part["image_url"]["url"]
            # image_url is a data URL: "data:image/png;base64,..."
            # Extract base64 data if needed
            if image_url.startswith("data:image/"):
                header, data = image_url.split(",", 1)
                image_bytes = base64.b64decode(data)

Example: Web Design Style Optimization

See the web design demo for a complete example of optimizing image generation prompts with gemini-2.5-flash-image.
Policy Configuration: The [prompt_learning.policy] section in config files is deprecated. Policy configuration is now handled automatically through the rollout function’s RolloutRequest.policy.config. The inference interceptor automatically routes to the correct provider and handles image generation models based on the model name.See LocalAPI Architecture for details on how policy configuration works in rollout functions.
See Prompt Optimization Configuration for policy/mutation/meta model details.