OpenAI Provider
OpenAI provides state-of-the-art language models offering excellent code analysis and fix suggestions.
Setup
-
Get API Key: Sign up at OpenAI Platform
-
Set Environment Variable:
bash export OPENAI_API_KEY=sk-your-api-key-here
-
Configure MegaLinter:
yaml LLM_ADVISOR_ENABLED: true LLM_PROVIDER: openai LLM_MODEL_NAME: gpt-4.1-mini LLM_MAX_TOKENS: 1000 LLM_TEMPERATURE: 0.1
Official Model List
For the most up-to-date list of OpenAI models and their capabilities, see the official OpenAI documentation:
Configuration Options
Basic Configuration
LLM_PROVIDER: openai
LLM_MODEL_NAME: gpt-4.1-mini # or gpt-4o-mini, gpt-4o
Advanced Configuration
# Custom API endpoint (for Azure OpenAI or compatible APIs)
OPENAI_BASE_URL: https://api.openai.com/v1
# Organization ID (optional)
OPENAI_ORGANIZATION: org-your-org-id
Troubleshooting
Common Issues
-
"Invalid API key"
- Verify your API key is correct
- Check that your account has available credits
- Ensure the key has proper permissions
-
"Rate limit exceeded"
- Reduce concurrent requests
- Upgrade to a higher tier plan
- Implement retry logic
-
"Model not found"
- Verify the model name is correct
- Check if you have access to the model
- Some models require special access
Debug Mode
LOG_LEVEL: DEBUG
This will show the exact requests and responses for troubleshooting.