pub fn extract_human_error_message(body: &str) -> StringExpand description
Extract the most human-readable error message from a provider’s JSON error body.
Handles all known provider response schemas:
- OpenAI/DeepSeek/ZAI/Anthropic:
{"error": {"message": "..."}} - HuggingFace:
{"error": "..."} - Gemini:
{"error": {"status": "..."}} - FastAPI / OpenAI alternate:
{"detail": "..."} - Generic:
{"message": "..."}
Falls back to the raw body if no known field is found.