Skip to main content
megvii-research avatar

NAFNet Denoise API

megvii-research/nafnet/denoise

Remove noise and grain from a photo and restore its quality, returning a clean image at the input's native resolution.

refine
0.0225 per megapixel of image

Model Input

Input

URL of the noisy or grainy image to denoise and restore.

Additional Settings

Customize your input with more control.

Optional seed for reproducible results.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Loading
Generated in 2.241 seconds
Logs (1 lines)

Model Example Requests

Examples

Example output 1

NAFNet Denoise API

NAFNet Denoise is a image-to-image AI model by megvii-research. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.0225 per megapixel.

POST https://queue.modelrunner.run/megvii-research/nafnet/denoise

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/megvii-research/nafnet/denoise \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://media.modelrunner.ai/6SozpRJV3o7dNUJ54opGZ.png",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/megvii-research/nafnet/denoise/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/megvii-research/nafnet/denoise/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("megvii-research/nafnet/denoise", {
  input: {
    "image_url": "https://media.modelrunner.ai/6SozpRJV3o7dNUJ54opGZ.png"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/megvii-research/nafnet/denoise",
    headers=headers,
    json={
      "image_url": "https://media.modelrunner.ai/6SozpRJV3o7dNUJ54opGZ.png"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

NameTypeRequiredDescription
image_urlstring (uri)yesURL of the noisy or grainy image to denoise and restore.
seedintegernoOptional seed for reproducible results.

Machine-readable: OpenAPI schema · llms.txt

Use NAFNet Denoise from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and NAFNet Denoise becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint megvii-research/nafnet/denoise.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run megvii-research/nafnet/denoise on ModelRunner to generate image”. MCP setup guide.

Model Details

Model Details

NAFNet Denoise removes noise, grain, and sensor artifacts from a photo and returns a cleaner, restored version at the input's native resolution. Provide a single noisy image and it reconstructs fine detail and smooth tones while preserving edges and structure, with no prompt or manual tuning required. It is built on NAFNet (Nonlinear Activation Free Network), a state-of-the-art image-restoration architecture from MEGVII Research introduced in the ECCV 2022 paper \"Simple Baselines for Image Restoration,\" trained on the SIDD smartphone-denoising dataset for realistic noise removal.\n\nThe model takes one image URL and an optional seed, and returns a single restored image URL. Because it restores at the original resolution, the output dimensions match the input — making it a clean before/after comparison.\n\n## Best for\n- Cleaning up low-light or high-ISO photos with visible grain and color noise\n- Removing sensor noise from smartphone and camera shots\n- Restoring scanned images, film grain, and old or degraded photographs\n- Reducing compression and JPEG artifacts before further editing or upscaling\n- Pre-processing noisy images ahead of detection, OCR, or other downstream pipelines\n\n## Choose another model when\n- You want to enlarge or add resolution rather than denoise — use an upscaling model\n- You need to fix motion or out-of-focus blur specifically — use a deblurring model\n- You want to relight, restyle, or edit content from a text prompt — use an image-editing or relighting model\n- You need to generate a new image from text with no source photo — use a text-to-image model\n\n## Tips\n- Pass the highest-quality version of the noisy image you have; the model restores at its native resolution, so input dimensions carry through to the output.\n- Set a `seed` only when you need reproducible results across runs.\n\n## Limitations\n- Very heavy noise can soften the finest texture as it is smoothed away.\n- It removes noise only — it does not sharpen blur, upscale, or correct exposure and color.\n\nTo run via the ModelRunner JavaScript client:\n```js\nimport { modelrunner } from \"@modelrunner/client\";\n\nconst result = await modelrunner.subscribe(\"megvii-research/nafnet/denoise\", {\n input: {\n image_url: \"https://media.modelrunner.ai/example-noisy-photo.png\",\n },\n});\n```