Image generation infrastructure

Generate images with AI, through one simple API

Call state-of-the-art models — Flux, Nano Banana 2, Ideogram — behind a single REST endpoint. Prepaid credits, async jobs, native Google & Apple sign-in. No GPUs to run.

create a job
# 1 — Authenticate (Firebase ID token)
POST /v1/auth/firebase  { "id_token": ... }
  → { "token": "..." }

# 2 — Create an image job
POST /v1/images/jobs
Authorization: Bearer <token>
{
  "model":  "flux-schnell",
  "prompt": "a red fox in snow"
}
  → { "id": "job_...", "status": "queued" }

# 3 — Poll until done, then save the image
GET /v1/images/jobs/job_...
  → { "status": "succeeded",
       "result_urls": ["https://..."] }
Why Lotus Image API

Everything you need to ship AI images

One account, one key, one billing model across every provider we aggregate.

Multiple models

Flux Schnell/Dev/Pro, Nano Banana 2, Ideogram — switch with a single slug.

Prepaid credits

Pay only for successful images. Failed jobs are refunded automatically.

Async jobs

Create a job, poll its status. No long-held connections, no mobile timeouts.

Mobile-ready

Native Google & Apple sign-in, session tokens, idempotency keys for retries.

Simple REST + JSON

Predictable endpoints, clear errors, no SDK required. Works from any language.

Built-in safety

Rate limits, daily spend caps and prompt moderation protect you from runaway cost.

Pricing

Credits per image

One credit model across every provider. You set the end-user price; we handle the wholesale side. Each job generates one image and charges the credits below.

ModelSlugTierCredits / image
Flux.1 Schnellflux-schnellFastest · draft1
Flux.1 Devflux-devBalanced6
Flux.1.1 Proflux-proHigh quality10
Flux Kontext Proflux-kontextEditing · context10
IdeogramideogramText in images12
Nano Banana 2nano-bananaPremium20

Live catalog is served from GET /v1/models. Credit values are defaults and can be tuned per deployment.

Credit packs (one-time)

PackCreditsPriceValue
Starter100$1.99—
Popular550$9.99+10% credits
Pro1,200$19.99+20% credits
Mega3,000$44.99+33% credits

Monthly plans (subscription)

PlanPrice / moCredits / moBest for
Lite$2.99200Casual use
Plus$7.99650Regular creators
Pro$14.991,400Power users
Studio$29.993,200Heavy / teams

New accounts start with 20 free credits. Credits are non-refundable and expire after ~12 months; failed generations are refunded automatically.

How it works

From sign-in to saved image in four calls

1

Sign in

App does native Google/Apple login, sends the ID token, gets a session token.

2

Create a job

POST a model + prompt. Credits are held and the job is queued.

3

Poll status

Check the job every 1–2s until succeeded or failed.

4

Save the image

Download result_urls to the device — the URLs are temporary.

API reference

Endpoints

Base URL https://api.lotusai.io.vn. All requests and responses are JSON. Every endpoint except GET /v1/models needs Authorization: Bearer <token>.

POST/v1/auth/firebasepublic

Sign in with Google/Apple through Firebase Auth, then send the Firebase ID token here. The backend verifies it with Firebase Admin and returns a session token; the user is created on first sign-in (keyed by Firebase UID).

Request
{ "id_token": "<firebase ID token>" }
Response 200
{
  "token": "<session_token>",
  "user_id": "uuid",
  "created": true
}
GET/v1/modelspublic

List active models and their credit price.

Request
GET /v1/models
Response 200
{ "models": [
  { "slug": "flux-schnell",
    "name": "Flux.1 Schnell",
    "credits": 1 }
]}
POST/v1/images/jobsbearer

Create an image job. Validates input, holds credits, queues the job. One job = one image. Pass an idempotency_key so retries never double-charge.

Request
{
  "model": "flux-schnell",
  "prompt": "a red fox in snow",
  "params": {},
  "idempotency_key": "optional"
}
Response 201
{ "id": "job_uuid",
  "status": "queued" }

// 402 out of credits
// 429 rate-limited
// 503 daily cap reached
GET/v1/images/jobs/{id}bearer

Get a job's status. status goes queued → running → succeeded | failed. On failed, credits are refunded automatically.

Request
GET /v1/images/jobs/job_uuid
Response 200
{
  "id": "job_uuid",
  "status": "succeeded",
  "model": "flux-schnell",
  "result_urls": ["https://..."],
  "error": null
}
POST/v1/images/quotebearer

Price a model and check the current balance before creating a job.

Request
{ "model": "flux-schnell" }
Response 200
{ "model": "flux-schnell",
  "credits": 1,
  "balance": 50,
  "affordable": true }
GET/v1/usagebearer

Current credit balance and usage summary.

Request
GET /v1/usage
Response 200
{ "balance": 48,
  "jobs": 12,
  "spent_credits": 14 }
POST/v1/billing/purchasebearer

Add credits from an Apple/Google in-app purchase. Idempotent per receipt — the same transaction never credits twice. source = apple | google.

Request
{
  "source": "apple",
  "transaction_id": "<from store>",
  "product_id": "credits_100"
}
Response 200
{ "credited": true,
  "balance": 148 }

// credited:false = already applied
POST/v1/billing/subscribebearer

Activate or confirm a subscription for the signed-in user — call after a successful store purchase. Grants that plan's monthly credits, idempotent per billing period. product_id = sub_lite | sub_plus | sub_pro | sub_studio. status = active | grace | canceled | expired.

Request
{
  "provider": "apple",
  "original_txn_id": "<from store>",
  "product_id": "sub_plus",
  "period_key": "<renewal id>"
}
Response 200
{ "status": "active",
  "credited": true,
  "balance": 698 }

// credited:false = period already granted
GET/v1/billing/subscriptionbearer

Current subscription state for the signed-in user.

Request
GET /v1/billing/subscription
Response 200
{ "subscriptions": [
  { "provider": "apple",
    "product_id": "sub_plus",
    "status": "active",
    "current_period_end": "..." }
]}
POST/v1/webhooks/{provider}store

Store server notifications (renewals, cancellations) — called by Apple/Google, not the app. Finds the user by original_txn_id and grants the new period's credits (idempotent). provider = apple | google.

Request
// store-signed notification payload
// (Apple ASSN v2 / Google RTDN)
Response 200
{ "ok": true,
  "status": "active",
  "credited": true }

Error codes

HTTPMeaningWhat the app should do
400Invalid input / content policy / unknown productFix input, show a message
401Missing / invalid / expired tokenRe-authenticate
402Not enough creditsPrompt to buy more (IAP)
404Job not found / not yoursIgnore
429Rate limit exceededBack off and retry
503Daily spend cap reachedTry again later
FAQ

Questions

Where are the images stored?

Providers return temporary URLs. Download them to the device as soon as a job succeeds — the API does not host images long-term.

What happens if generation fails?

The job is marked failed with an error message and the held credits are refunded automatically.

How do I avoid double charges?

Send an idempotency_key when creating a job and the store transaction_id when crediting a purchase. Retries are safe.

Which models should I start with?

flux-schnell for fast drafts (1 credit), flux-pro (10 credits) or nano-banana (20) for premium quality.

How is billing handled on mobile?

Credits are sold through Apple/Google in-app purchase. The receipt is verified server-side before credits are added.

Is there a usage limit?

Per-user rate limits and a daily spend cap are built in to protect against abuse and runaway cost. Both are configurable.

Get started

Ship AI images this week

The full integration guide for the mobile team lives in API.md. Point your app at the base URL and start generating.

View the endpoints