genmux API is now generally available. Read the docs →
genmux API

Blog

Migrating to Unified Image API from Google AI Studio, fal.ai or Replicate

2 min readWritten by Unified Image API Team


Moving an existing Nano Banana integration here is usually an afternoon: the concepts map one-to-one, and the differences are the parts you'll be glad to delete. Below are the mappings we're asked about most.

The mental model

ConceptGoogle AI Studio (Gemini API)ReplicateUs
Call stylesync generateContentasync predictionasync job
Authx-goog-api-keyAuthorization: BearerAuthorization: Bearer
Resultbase64 in responseURL when prediction completespresigned URL on the job
Retry safetynone built innone built inmandatory Idempotency-Key
Failed callbilled per tokendependscredits auto-refunded
Completion pushnonewebhookssigned webhooks

From Google AI Studio

Google's API is synchronous and returns the image inline as base64. Two changes:

  1. Split the call. POST /v1/generations (get id) then poll GET /v1/generations/{id} or use webhook_url. Your timeout problems disappear: the submit returns in milliseconds regardless of model load.
  2. Fetch instead of decode. Results come as presigned URLs valid 15 minutes — stream them to your storage instead of holding base64 blobs in memory.
diff
- POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent
- {"contents":[{"parts":[{"text":"a red fox in snow"}]}]}
+ POST $BASE/v1/generations
+ {"model":"nanobanana","prompt":"a red fox in snow","resolution":"1K","ratio":"1:1"}

The prompt string itself transfers unchanged — same underlying model family, same prompting behaviour.

From Replicate

The shape is already familiar (create prediction → poll/webhook). What changes:

  • version hashes → stable model ids (nanobanana, nanobanana-pro) listed at GET /v1/models; no pinning ceremony, routing and failover happen behind the id.
  • input: {...} → flat body: prompt, resolution (1K/2K/4K), ratio, n, seed, plus images for image-to-image. The legacy size field ("1024x1024") is still accepted and mapped to the nearest tier and ratio.
  • Billing: per-second GPU pricing → fixed credits per image, known before you submit (cost in the response), refunded on failure.

The checklist

  1. Create a key, put real traffic's IP ranges in the key's allowlist.
  2. Wrap submit with an Idempotency-Key per user intent (see our idempotency post).
  3. Map your error handling to code values — the errors table is short.
  4. Run both providers in parallel for a day (credits are prepaid; a test run on the Starter pack costs a few dollars) and compare failure rates before switching DNS-style.

Full request/response schemas with real payloads: API reference. Per-model pricing in USD: models.

About the author

Written by Unified Image API Team — genmux API.

More about us