[Integrations](https://spiral.ai/integrations) › [Amp](https://spiral.ai/integrations/amp) › [CodeFormer](https://spiral.ai/integrations/amp/codeformer)

# How to Use CodeFormer in Amp

CodeFormer restores faces in old photos and AI-generated portraits. Its fidelity control lets you favor cleaner facial details or a closer match to the original.

|  |  |
| --- | --- |
| Model | CodeFormer |
| Available through | fal |
| Category | Image |
| Price | Up to $0.00273 per run at the default inputs. |
| Returns | image |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with CodeFormer in Amp

- Use CodeFormer on the old portrait scans in assets/portraits at fidelity 0.7. Save separate restored copies and create a comparison page beside the originals.
- Use CodeFormer on assets/generated-portrait.png at fidelity 0.3 and 0.7. Show both results with the source so I can compare the eyes, mouth, and accessories.
- Use CodeFormer to restore assets/group-photo.jpg as a whole image at fidelity 0.7. Create enlarged comparison crops of each face for review.
- Use CodeFormer on the prepared 512 by 512 face crops in assets/aligned with aligned processing enabled. Save the results separately and record the settings.
- Use CodeFormer to restore assets/portrait.jpg at fidelity 0.7 and 2 times scale. Confirm the resulting dimensions and add a before-and-after view to the project's image review page.

## How to set up CodeFormer in Amp

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: No header and no client ID or secret: Amp registers itself with Spiral.

```bash
amp mcp add spiral https://api.spiral.ai/mcp
```

2. **Sign in**: Start `amp`. Amp opens Spiral's sign-in page in your browser: sign in, pick the organization and click Authorize. No API key.

3. **Check it**

```bash
amp mcp doctor
```

### Use the Spiral skill

1. **Send Amp this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run CodeFormer**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "fal",
    "model": "fal-ai/codeformer",
    "input": {
      "image_url": "https://storage.googleapis.com/falserverless/model_tests/codeformer/codeformer_poor_1.jpeg"
    }
  }'
```

Then paste one of the prompts above: Amp finds CodeFormer on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/amp

## CodeFormer tools and prices

- [CodeFormer](https://spiral.ai/tools/fal/fal-ai/codeformer) (fal): Up to $0.00273 per run at the default inputs.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| fidelity |  | 0.5 | Weight of the fidelity factor. |
| upscale_factor | 1 to … | 2 | Upscaling factor |
| aligned |  | false | Should faces etc should be aligned. |
| only_center_face |  | false | Should only center face be restored |
| face_upscale |  | true | Should faces be upscaled |
| seed |  | — | Random seed for reproducible generation. |

## What can you do with CodeFormer in Amp?

Restore portrait assets in your project and build comparisons for review. Use the agent to process selected images, record restoration settings, and keep the originals beside the results.

### Restore scanned portraits

Use CodeFormer to make restored copies of old portrait scans. Compare a higher fidelity result with the scan before adding it to a photo collection.

### Repair generated faces

Run CodeFormer on AI-generated portraits with unsatisfactory facial detail. Compare two fidelity settings and inspect the eyes, mouth, and accessories.

### Restore faces within group photos

Use CodeFormer's whole-image processing to restore faces within an old group photograph. Review each person's result and the hair boundaries before keeping the image.

### Prepare portrait enlargements

Restore a portrait with CodeFormer and increase the whole-image dimensions for a larger layout. Inspect facial resemblance and blending at the intended display size.

### Process aligned face crops

Use CodeFormer on prepared, aligned portrait crops for an image collection. The authors' restoration example uses 512 by 512 face images.

### Compare restoration choices

Create CodeFormer results at lower and higher fidelity settings for an editorial review. Keep the source beside both results so an editor can judge resemblance and detail.

## Overview

- [fal](https://spiral.ai/providers/fal)
- [All Amp guides](https://spiral.ai/integrations/amp)

## CodeFormer in other agents

- [ChatGPT](https://spiral.ai/integrations/chatgpt/codeformer)
- [Claude](https://spiral.ai/integrations/claude-desktop/codeformer)
- [Claude Code](https://spiral.ai/integrations/claude-code/codeformer)
- [Cline](https://spiral.ai/integrations/cline/codeformer)
- [Codex](https://spiral.ai/integrations/codex/codeformer)
- [Cursor](https://spiral.ai/integrations/cursor/codeformer)
- [Devin](https://spiral.ai/integrations/devin/codeformer)
- [dots](https://spiral.ai/integrations/dots/codeformer)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/codeformer)
- [Gemini](https://spiral.ai/integrations/gemini/codeformer)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/codeformer)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/codeformer)
- [goose](https://spiral.ai/integrations/goose/codeformer)
- [Grok](https://spiral.ai/integrations/grok/codeformer)
- [Grok Build](https://spiral.ai/integrations/grok-build/codeformer)
- [Hermes](https://spiral.ai/integrations/hermes/codeformer)
- [Instinct](https://spiral.ai/integrations/instinct/codeformer)
- [Manus](https://spiral.ai/integrations/manus/codeformer)
- [Muse](https://spiral.ai/integrations/muse/codeformer)
- [Muse Code](https://spiral.ai/integrations/muse-code/codeformer)
- [n8n](https://spiral.ai/integrations/n8n/codeformer)
- [Notion](https://spiral.ai/integrations/notion/codeformer)
- [OpenClaw](https://spiral.ai/integrations/openclaw/codeformer)
- [opencode](https://spiral.ai/integrations/opencode/codeformer)
- [Perplexity](https://spiral.ai/integrations/perplexity/codeformer)
- [Raycast](https://spiral.ai/integrations/raycast/codeformer)
- [VS Code](https://spiral.ai/integrations/vscode/codeformer)
- [Windsurf](https://spiral.ai/integrations/windsurf/codeformer)
- [Zapier](https://spiral.ai/integrations/zapier/codeformer)

## More Amp guides

- [Clarity Upscaler](https://spiral.ai/integrations/amp/clarity-upscaler)
- [Color Tint](https://spiral.ai/integrations/amp/color-tint)
- [City Teleport](https://spiral.ai/integrations/amp/city-teleport)
- [Crystal Upscaler](https://spiral.ai/integrations/amp/crystal-upscaler)
- [Chromatic Aberration](https://spiral.ai/integrations/amp/chromatic-aberration)
- [DDColor](https://spiral.ai/integrations/amp/ddcolor)

## Questions about CodeFormer in Amp

**Can Amp use CodeFormer?**

Yes. Add Spiral to Amp as an MCP server, and Amp can find and run CodeFormer like any built-in tool.

**How much does CodeFormer cost in Amp?**

Up to $0.00273 per run at the default inputs. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Amp plan is separate.

**Do I need a fal account to use CodeFormer in Amp?**

No. Spiral runs CodeFormer on its own fal account. You sign in to Spiral once and never paste a key.

**How long does it take to set up CodeFormer in Amp?**

About two minutes: add the server, then sign in, then check it.

**Does Amp wait while CodeFormer runs?**

CodeFormer runs in the background. Amp starts the run, checks on it and gives you the image when it's ready.

**What is CodeFormer useful for?**

Use it to restore facial detail in old photographs or repair faces in AI-generated portraits. Compare the result with the original before keeping it.

**How should I choose the fidelity setting?**

Higher values favor resemblance to the original; lower values favor visual quality. Try 0.3 and 0.7 on the same image, then compare facial features before choosing.

**Does CodeFormer always preserve the person's appearance?**

Identity inconsistencies can remain, especially around unusual accessories. A higher fidelity setting favors resemblance, but review the result yourself.

**What image size does CodeFormer produce?**

The authors demonstrate cropped face restoration at 512 by 512 pixels. For whole images, the final dimensions follow the upscale factor: doubling a 600 by 400 image produces 1200 by 800.

**Where does CodeFormer struggle?**

The authors report failures on side-facing portraits and inconsistencies around accessories. Whole-image blending can also damage hair texture at the restored face's boundary.

