LemonData의 Agent-First API는 오류 응답에 AI 에이전트가 즉시 파싱하고 조치를 취할 수 있는 구조화된 힌트를 추가합니다. 웹 검색, 문서 조회, 추측이 필요 없습니다.모든 오류 응답에는 표준 error 객체 내부에 did_you_mean, suggestions, hint, retryable, retry_after와 같은 선택적 필드가 포함됩니다. 이 필드들은 하위 호환성을 유지하므로, 이를 사용하지 않는 클라이언트에게는 아무런 차이가 없습니다.
{ "error": { "message": "Model 'gpt5' not found", "type": "invalid_request_error", "param": "model", "code": "model_not_found", "did_you_mean": "gpt-4o", "suggestions": [ {"id": "gpt-4o"}, {"id": "gpt-4o-mini"}, {"id": "claude-sonnet-4-5"} ], "hint": "Did you mean 'gpt-4o'? Use GET /v1/models to list all available models." }}
{ "error": { "message": "Insufficient balance: need ~$0.3500 for claude-sonnet-4-5, but balance is $0.1200.", "type": "insufficient_balance", "code": "insufficient_balance", "balance_usd": 0.12, "estimated_cost_usd": 0.35, "suggestions": [ {"id": "gpt-4o-mini"}, {"id": "deepseek-chat"} ], "hint": "Insufficient balance: need ~$0.3500 for claude-sonnet-4-5, but balance is $0.1200. Try a cheaper model, or top up at https://lemondata.cc/dashboard/billing." }}
suggestions에는 에이전트가 전환할 수 있는 예상 비용보다 저렴한 모델들이 포함됩니다.
{ "error": { "message": "This model's maximum context length is 128000 tokens...", "type": "invalid_request_error", "code": "context_length_exceeded", "retryable": false, "suggestions": [ {"id": "gemini-2.5-pro"}, {"id": "claude-sonnet-4-5"} ], "hint": "Reduce your input or switch to a model with a larger context window." }}
네이티브 엔드포인트(Anthropic 또는 Gemini)가 있는 모델로 /v1/chat/completions를 호출하면, 성공 응답에 최적화 헤더가 포함됩니다:
복사
X-LemonData-Hint: This model supports native Anthropic format. Use POST /v1/messages for better performance (no format conversion).X-LemonData-Native-Endpoint: /v1/messages