Browse all docs & guides
On this page
OPERATION & PLATFORM GUIDE

Upscale images with megapixel-aware controls

OpenGen models image upscaling as a dedicated image-upscale operation with scale-factor controls and megapixel-aware pricing inspection. Upload one workspace-private source image through POST /v1/assets, inspect exact schema limits for clarity/clarity-upscaler via GET /v1/models/clarity/clarity-upscaler?operation=image-upscale, check route readiness and pricing with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key when an executable route is configured.

operation: image-upscaleReviewed 2026-12-02
AGENT PROMPT · PASTE INTO YOUR AGENT OR AUTO-READ
Walk me through an image-upscale request on OpenGen (https://opengen.dev):
1. Discover upscaling models with GET https://opengen.dev/v1/models?operation=image-upscale (or MCP find_models with operation="image-upscale").
2. Inspect exact schema bounds and published megapixel pricing via GET https://opengen.dev/v1/models/clarity/clarity-upscaler?operation=image-upscale (or MCP get_model with id="clarity/clarity-upscaler", operation="image-upscale"). Note that resolution and aspectRatio are unsupported; use scale (1-4) and optional strength (0-1).
3. Upload the single private source image with POST https://opengen.dev/v1/assets (or MCP upload_asset) and verify state="ready".
4. Run POST https://opengen.dev/v1/pricing/estimate (or MCP estimate_cost) to inspect workspaceEligibility and megapixel pricing disclosures. Stop and report if the route is documented/comparison-only on the current gateway.
5. Only when an executable route is eligible and I confirm the spend cap, submit once with a persisted Idempotency-Key via POST https://opengen.dev/v1/generations or MCP generate.
View raw .md ↗

OpenGen separates detail-preserving upscaling into its own image-upscale operation so clients can specify numeric scale factors and optional creativity strength without overloading general image-edit schemas.

1. Inspect the upscaler schema and pricing

Clarity Upscaler (clarity/clarity-upscaler) is an open-weights upscaler documented on fal (fal-undisclosed/clarity-clarity-upscaler) with published megapixel pricing ($0.03 per output megapixel—for example, a 4 MP output is $0.12, scaling proportionally with input dimensions and scale).

curl --fail-with-body \
  "https://opengen.dev/v1/models?operation=image-upscale"

curl --fail-with-body \
  "https://opengen.dev/v1/models/clarity/clarity-upscaler?operation=image-upscale"

Valid clarity/clarity-upscaler fields

FieldRequiredAllowed values
referencesYesExactly 1 image reference ({ "type": "image", "asset": { "assetKey": "..." } }).
scaleOptionalNumber from 1 to 4 (default 2).
strengthOptionalNumber from 0 to 1 controlling detail hallucination vs source faithfulness.
promptOptionalGuidance prompt (up to 4,000 characters); not required.
negativePromptOptionalArtifacts to suppress during upscaling.
outputFormatOptionalpng, jpeg, or webp.
seedOptionalInteger seed for reproducible enhancement.

Passing resolution, aspectRatio, firstFrame, or mask is rejected with 400 invalid_generation before any credits are reserved because output dimensions derive directly from the source image and scale.

2. Upload the private source image

Upload the source image privately via POST /v1/assets (<= 4 MiB multipart, <= 3 MiB JSON base64, or presigned PUT up to 100 MiB) or reuse a previous OpenGen image output with { "source": "job_output", "sourceJobId": "<job-uuid>", "outputIndex": 0 }.

curl --fail-with-body \
  -X POST "https://opengen.dev/v1/assets" \
  -H "Authorization: Bearer $OPENGEN_API_KEY" \
  -H "Idempotency-Key: upscale-src-$(uuidgen | tr '[:upper:]' '[:lower:]')" \
  -F "file=@./product-shot.png;type=image/png"

3. Estimate route eligibility before submitting

Run POST /v1/pricing/estimate first to validate the canonical request and check workspaceEligibility. Because megapixel billing scales with the source image's actual pixel area (width * height * scale^2), managed image-upscale quotes are currently comparison-only (selectedRouteId: null); once an execution adapter is enabled on your gateway, use "billing": "byok" with your connected provider credential (omitting maxCostMicros, since OpenGen cannot cap direct BYOK provider charges).

set -eu
umask 077
if [ -e upscale-submission.key ]; then
  echo "Existing upscale-submission.key found; recover read-only via GET /v1/generations/lookup before replacing upscale-request.json." >&2
  exit 1
fi
rm -f upscale-request.json
cat <<'JSON' > upscale-request.json
{
  "modelId": "clarity/clarity-upscaler",
  "operation": "image-upscale",
  "input": {
    "references": [
      {
        "type": "image",
        "asset": {
          "assetKey": "inputs/YOUR_WORKSPACE/RETURNED_IMAGE_UUID.png"
        }
      }
    ],
    "scale": 2,
    "strength": 0.35,
    "prompt": "Sharp architectural detail, crisp textures, faithful preservation of original edges",
    "outputFormat": "png"
  },
  "routeId": "fal-undisclosed/clarity-clarity-upscaler",
  "billing": "byok"
}
JSON
chmod 600 upscale-request.json

# Dry-run estimate only (review selectedRouteId and workspaceEligibility before submitting)
curl --fail-with-body \
  -X POST "https://opengen.dev/v1/pricing/estimate" \
  -H "Authorization: Bearer $OPENGEN_API_KEY" \
  -H "Content-Type: application/json" \
  --data @upscale-request.json

Submit once after reviewing the estimate

Run this step only after reviewing the estimate output above and confirming an executable route is eligible (selectedRouteId != null, executableCandidateCount > 0, blockers: []) and confirming your billing payer.

set -eu
umask 077
if [ -e upscale-submission.key ]; then
  echo "Existing upscale-submission.key found; recover read-only via GET /v1/generations/lookup before creating a new submission." >&2
  exit 1
fi
RAW_UUID="$(uuidgen)"
[ -n "$RAW_UUID" ] || { echo "uuidgen failed" >&2; exit 1; }
IDEMPOTENCY_KEY="upscale-$(printf '%s' "$RAW_UUID" | tr '[:upper:]' '[:lower:]')"
(set -C; printf '%s\n' "$IDEMPOTENCY_KEY" > upscale-submission.key)

curl --fail-with-body \
  -X POST "https://opengen.dev/v1/generations" \
  -H "Authorization: Bearer $OPENGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Prefer: wait=20" \
  --data @upscale-request.json > upscale-receipt.json

4. Check job status and download privately

If a generation returns 202 Accepted, poll GET /v1/generations/{id}/status?waitMs=25000 or call MCP job_get. Recover any interrupted submission with GET /v1/generations/lookup?idempotencyKey=$IDEMPOTENCY_KEY instead of generating a new key.

Next steps

  • Need transparent subject extraction before or after upscaling? See Background Removal.
  • Need prompt-driven local edits at 2K or 4K on models with active image-edit adapters? See Image Editing.

Supported Models

Live catalog inventory for image-upscale (1 documented variant). Click any model to compare exact regional routes, privacy disclosures, and source-linked tariffs, or inspect its canonical schema directly via the single-call model endpoint.

ModelCreatorRoutesLowest published priceSingle-call API
Clarity UpscalerOpen weights
clarity/clarity-upscaler
Clarity AI1 route$0.03 / MPGET /v1/models/clarity/clarity-upscaler?operation=image-upscale