# Use a powerful model for optimization reasoning
optimizer = MetaPromptOptimizer(
    model="openai/gpt-4o"  # Best reasoning capabilities
)
```

<Tip>
  **Recommendation:** Use a capable model like `gpt-4o` or `claude-3-5-sonnet` for the optimizer, even if your production application uses a smaller model. The optimizer only runs during development, so the cost is minimal compared to the quality improvements you'll achieve.
</Tip>

## Troubleshooting

<AccordionGroup>
  <Accordion title="AuthenticationError: Invalid API key">
    Ensure your API key is correctly set in the environment:

    ```bash
    # Check if the key is set
    echo $OPENAI_API_KEY

    # Set it if missing
    export OPENAI_API_KEY="sk-..."
    ```
  </Accordion>

  <Accordion title="Model not found">
    Verify the model name follows the LiteLLM format `provider/model-name`:

    ```python
    # ✅ Correct
    model="openai/gpt-4o"
    model="gemini/gemini-2.0-flash"

    # ❌ Incorrect
    model="gpt-4o"  # Missing provider prefix
    model="google/gemini-2.0-flash"  # Wrong provider name (use 'gemini')
    ```
  </Accordion>

  <Accordion title="Rate limiting errors">
    If you encounter rate limits, try:

    * Reducing `n_threads` in the optimizer
    * Using a model with higher rate limits
    * Adding delays between API calls
  </Accordion>
</AccordionGroup>

## Next Steps

* Learn about [Optimization Concepts](/agent_optimization/optimization/concepts)
* Explore different [Optimization Algorithms](/agent_optimization/algorithms/overview)
* Check out the [API Reference](/agent_optimization/advanced/api_reference)

<Info>
  For a complete list of supported providers and models, see the [LiteLLM documentation](https://docs.litellm.ai/docs/providers).
</Info>