Skip to main content
CodeFormerFastHigh

CodeFormer

Robust face restoration for old photos and AI-generated faces (54M+ runs). Its signature fidelity dial balances restoration quality against staying true to the original face, with Real-ESRGAN background enhancement built in.

8 credits
per image
Quality vs fidelity balance dial (codeformer_fidelity)
Robust on heavily degraded faces
Built-in Real-ESRGAN background enhancement
Face upsampling for high-resolution output
Adjustable final upscale factor

Run it right now

Test this model instantly in the Console Playground โ€” no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Quick Start

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "sczhou/codeformer",
  "input": {
    "image": "https://example.com/degraded-photo.jpg",
    "codeformer_fidelity": 0.7,
    "upscale": 2,
    "background_enhance": true,
    "face_upsample": true
  }
}'

Parameters

ParameterTypeRequiredDefaultDescription
imagestringYes-Input image with faces to restore
codeformer_fidelitynumberNo0.5Balance between quality (lower) and fidelity to the original face (higher), 0-1
background_enhancebooleanNotrueEnhance the background with Real-ESRGAN
face_upsamplebooleanNotrueUpsample restored faces for high-resolution output
upscaleintegerNo2Final upsampling scale of the image

How to Provide File Input

There are 3 ways to provide files for the image parameter:

Recommended

Direct Upload (Multipart)

Attach files directly to POST /v1/predictions/upload. No separate upload step needed.

curl -X POST "https://api.core.today/v1/predictions/upload" \
  -H "X-API-Key: cdt_your_api_key" \
  -F "model=sczhou/codeformer" \
  -F 'input={"prompt":"your prompt here"}' \
  -F "file:image=@your_file.png"

Image URL

Pass a publicly accessible URL directly. You can also use file_url from the Storage API.

{
  "model": "sczhou/codeformer",
  "input": {
    "prompt": "your prompt here",
    "image": "https://example.com/image.jpg"
  }
}
See the File Upload docs for more upload methods including Presigned URLs.

Common Parameters

Common parameters used when calling POST /v1/predictions.

ParameterTypeRequiredDefaultDescription
modelstringYes-Model identifier
inputobjectYes-Object containing the model-specific parameters from the table above
output_folderstringNo-Folder path for output files (max 256 chars, '..' not allowed)
webhook_urlstringNo-Webhook URL to call on completion
is_publicbooleanNofalseIf true, output files are also available via permanent public URLs

Examples

Degraded Photo Restoration

Restore a heavily degraded photo, balancing quality and identity

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "sczhou/codeformer",
  "input": {
    "image": "https://example.com/degraded-photo.jpg",
    "codeformer_fidelity": 0.7,
    "upscale": 2,
    "background_enhance": true,
    "face_upsample": true
  }
}'

Tips & Best Practices

1Raise codeformer_fidelity (0.7-0.9) to keep the person recognizable; lower it (0.3) for maximum cleanup
2Keep background_enhance on for complete photo restoration in one pass
3More robust than GFPGAN on severely degraded inputs; GFPGAN can look more natural on mild cases
4upscale 2 is usually enough โ€” chain Real-ESRGAN if you need larger output

Use Cases

Severely degraded photo restoration
AI face artifact correction
Historical archive restoration
Video frame face cleanup
Identity-preserving enhancement