申請流程
要使用 API,需要先到 人像動漫化 API 對應頁面申請對應的服務,進入頁面之後,點擊「Acquire」按鈕,如圖所示:
如果你尚未登錄或註冊,會自動跳轉到登錄頁面邀請您來註冊和登錄,登錄註冊之後會自動返回當前頁面。
在首次申請時會有免費額度贈送,可以免費使用該 API。
基本使用
首先先了解下基本的使用方式,就是輸入圖片鏈接,便可獲得處理後結果圖片,首先需要簡單地傳遞一個image_url 字段,人臉圖片如下圖所示:


accept:想要接收怎樣格式的響應結果,這裡填寫為application/json,即 JSON 格式。authorization:調用 API 的密鑰,申請之後可以直接下拉選擇。
image_url:需要處理的人臉圖片鏈接。

image_url 字段,就是變化後的卡通人臉圖片。其中變化後人臉信息如下所示:

錯誤處理
在調用 API 時,如果遇到錯誤,API 會返回相應的錯誤代碼和信息。例如:400 token_mismatched:Bad request, possibly due to missing or invalid parameters.400 api_not_implemented:Bad request, possibly due to missing or invalid parameters.401 invalid_token:Unauthorized, invalid or missing authorization token.429 too_many_requests:Too many requests, you have exceeded the rate limit.500 api_error:Internal server error, something went wrong on the server.

