# CodeFormer > Robust face restoration for old photos and AI-generated faces (54M+ runs), with adjustable quality/fidelity balance and Real-ESRGAN background enhancement. - **Provider**: replicate - **Model ID**: sczhou/codeformer - **Category**: image_upscale_restore - **Credits**: 8 per request - **Pricing Type**: fixed ## API Endpoint Base URL: https://api.core.today/v1 ### Create Prediction POST /predictions ### Get Status GET /predictions/{job_id} ### Cancel DELETE /predictions/{job_id} ## Authentication Header: `X-API-Key: YOUR_API_KEY` ## Input Parameters - `face_upsample` (boolean, optional): Upsample restored faces for high-resolution AI-created images (Default: `True`) - `image` (string, **required**): Input image - `background_enhance` (boolean, optional): Enhance background image with Real-ESRGAN (Default: `True`) - `upscale` (integer, optional): The final upsampling scale of the image (Default: `2`) - `codeformer_fidelity` (number, optional): Balance the quality (lower number) and fidelity (higher number). (Default: `0.5`; Range: min: 0, max: 1) ## Example Request ```json { "model": "sczhou/codeformer", "input": { "codeformer_fidelity": 0.1, "upscale": 2, "face_upsample": true, "image": "https://replicate.delivery/mgxm/a11098b0-a18a-4c02-a19a-9a7045d68426/010.jpg", "background_enhance": true } } ``` ## Response Format ```json { "job_id": "abc123", "status": "pending", "provider": "replicate", "model": "black-forest-labs/flux-schnell", "created_at": "2026-01-01T00:00:00Z", "result": null, "error": null } ``` Status values: `pending`, `processing`, `completed`, `failed`, `cancelled` ## Usage Flow 1. POST /predictions with model and input → receive job_id 2. Poll GET /predictions/{job_id} until status is `completed` or `failed` 3. Result contains output URL(s) or data ## Output Type url ## Tags face-restoration, upscaling, photo-restoration, codeformer ## Documentation https://replicate.com/sczhou/codeformer