{
    "$schema": "./provider-rules.schema.json",
    "id": "openai",
    "errors": {
        "rules": [
            {
                "status": 401,
                "bodyErrorType": "invalid_api_key",
                "pattern": "API_KEY_INVALID|Invalid API key|Incorrect API key|invalid_api_key",
                "class": "authentication",
                "message": "Invalid OpenAI API key. Please check your OPENAI_API_KEY environment variable.",
                "messageWhen": [
                    {
                        "pattern": "Incorrect API key|Invalid API key",
                        "message": "{message}"
                    }
                ]
            },
            {
                "bodyErrorType": "insufficient_quota",
                "class": "provider",
                "message": "OpenAI quota exhausted — this will not resolve by retrying. Check your plan and billing details at https://platform.openai.com/account/billing"
            },
            {
                "status": 429,
                "bodyErrorType": "rate_limit_error",
                "pattern": "rate limit",
                "class": "rate-limit",
                "message": "OpenAI rate limit exceeded. Please try again later."
            },
            {
                "pattern": "model_not_found",
                "class": "invalid-model",
                "message": "Model not found: {model}"
            }
        ]
    }
}
