[Integrations](https://spiral.ai/integrations) › [Codex](https://spiral.ai/integrations/codex) › [Smart Resize](https://spiral.ai/integrations/codex/smart-resize)

# How to Use Smart Resize in Codex

Smart Resize adapts existing artwork to new dimensions using Nano Banana Pro to recompose the layout. Use it for turning one campaign image into square, portrait, and landscape assets, then review the regenerated details.

|  |  |
| --- | --- |
| Model | Smart Resize |
| Available through | fal |
| Category | Image |
| Price | Up to $0.26 per run at the default inputs. `resolution`: 1K (default) $0.26, 2K $0.26, 4K $0.52. Each item in `target_sizes` adds $0.195. $0.195 per unit of `num_images_per_size`. |
| Returns | image |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Smart Resize in Codex

- Use Smart Resize on public/images/hero.png to create a 1920x1080 image. Ask for empty space on the left for the headline, then preview it in the hero component.
- Use Smart Resize on assets/campaign.png to create 1024x1024 and 768x1344 images. Leave the extra instruction empty and show both beside the source for review.
- Use Smart Resize to adapt public/images/article-cover.png to 1200x630. Save the result beside the original and verify the finished dimensions.
- Use Smart Resize on assets/product-promo.png to make a 1024x1024 image. Request that the whole product remain visible, then compare its details with the source.
- Use Smart Resize on public/images/newsletter-art.png to create a 1200x400 banner. Request a centered subject and preview the result in the email template.

## How to set up Smart Resize in Codex

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

### Use Spiral's MCP server

1. **Add the hosted server**

```bash
codex mcp add spiral --url https://api.spiral.ai/mcp
```

2. **Sign in**: Codex opens the browser: sign in to Spiral and click Authorize. No API key. `codex mcp list` then shows Spiral.

```bash
codex mcp login spiral
```

### Use the Spiral skill

1. **Send Codex 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 Smart Resize**: 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/smart-resize",
    "input": {
      "image_url": "https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png",
      "target_sizes": [
        "<target_sizes>"
      ]
    }
  }'
```

Then paste one of the prompts above: Codex finds Smart Resize on Spiral, shows the price and runs it.

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

## Smart Resize tools and prices

- [Smart Resize](https://spiral.ai/tools/fal/fal-ai/smart-resize) (fal): `resolution`: 1K (default) $0.065 per run plus $0.195 per image, 2K $0.065 per run plus $0.195 per image, 4K $0.13 per run plus $0.39 per image. Billed on `num_images_per_size`, default 1.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| prompt |  |  | Optional extra instruction that is forwarded to nano-banana-pro alongside the auto-generated resize prompt. Leave empty to let the model preserve the original image content as closely as possible. |
| num_images_per_size | 1 to 4 | 1 | The number of nano-banana-pro variants to produce for each target size. The response images list will contain ``len(target_sizes) * num_images_per_size`` images in total. |
| resolution | 1K, 2K, 4K | 1K | Hint for the minimum resolution tier to use internally. The smart-resize algorithm may pick a higher tier automatically when the requested target size is too large for this tier. This field does not affect the final output dimensions — those come from ``target_sizes``. |
| output_format | jpeg, png, webp | png | The output image format. |
| safety_tolerance | 1, 2, 3, 4, 5, 6 | 4 | The safety tolerance level applied to the inner nano-banana-pro /edit calls. Higher numbers loosen safety filtering. |
| seed |  | — | Optional random seed forwarded to the inner nano-banana-pro /edit calls for reproducibility. The same seed is used for every target size when set. |

## What can you do with Smart Resize in Codex?

Adapt project artwork to the dimensions your interface needs. Your coding agent can prepare the assets and compare their framing with the source before placing them in the page.

### Campaign assets in several shapes

Adapt one existing campaign image into square, portrait, and landscape layouts. Review the subject placement and any embedded copy.

### Website hero artwork

Recompose an existing illustration or photo for a wide hero slot, with an instruction to leave room for the page headline.

### Product promotion images

Turn existing product artwork into assets for different placements. Compare the regenerated product details with the source before approval.

### Article preview images

Adapt an article's existing lead image to a landscape sharing image and a square preview.

### Event promotion artwork

Reframe an existing event graphic for horizontal and vertical placements. Check dates, names, and logos against the original.

### Email banner artwork

Adapt an existing campaign visual to an exact email banner size, requesting a composition that keeps the main subject visible.

## Overview

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

## Smart Resize in other agents

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

## More Codex guides

- [Seedream 5.5 Text to Image](https://spiral.ai/integrations/codex/seedream-5-5-text-to-image)
- [Solarize](https://spiral.ai/integrations/codex/solarize)
- [Seedream 5.5 Layerize](https://spiral.ai/integrations/codex/seedream-5-5-layerize)
- [Texture Transform](https://spiral.ai/integrations/codex/texture-transform)
- [Seedream 5.5 Image Edit](https://spiral.ai/integrations/codex/seedream-5-5-image-edit)
- [Topaz Adjust Image](https://spiral.ai/integrations/codex/topaz-adjust-image)

## Questions about Smart Resize in Codex

**Can Codex use Smart Resize?**

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

**How much does Smart Resize cost in Codex?**

Up to $0.26 per run at the default inputs. `resolution`: 1K (default) $0.26, 2K $0.26, 4K $0.52. Each item in `target_sizes` adds $0.195. $0.195 per unit of `num_images_per_size`. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Codex plan is separate.

**Do I need a fal account to use Smart Resize in Codex?**

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

**How long does it take to set up Smart Resize in Codex?**

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

**Does Codex wait while Smart Resize runs?**

Smart Resize runs in the background. Codex starts the run, checks on it and gives you the image when it's ready.

**What is Smart Resize good for?**

Adapting existing artwork to different shapes and exact pixel sizes. Useful examples include turning a landscape campaign image into square posts, portrait ads, and website banners.

**How does Smart Resize change the composition?**

It uses Nano Banana Pro to regenerate the image for the new layout, then center-crops the result to the requested dimensions. Review the framing before approving the output.

**Will Smart Resize preserve every detail exactly?**

Treat the result as regenerated artwork. Because the process recomposes the image, review text, logos, and product details; use a conventional resize or crop when identical source pixels are required.

**What should I write in the extra instruction?**

Leave it empty when your priority is preserving the original content. When you need a layout change, give a specific direction such as keeping the product centered or leaving space above the subject.

**Does the resolution setting determine the finished image size?**

No. The requested width and height determine the finished dimensions; the resolution setting guides the internal generation tier.

